Steps to resolve an Approval Coordinator issue where the workflow is stuck because of a missing condition "activity.result=='skipped'"



The workflow gets stuck on the Approval Coordinator activity if the activity doesn't result in any approvals or if the approvers are Inactive.


Prior to Jakarta the Approval Coordinator workflow activity did not include a condition "activity.result == 'skipped'".

As a result, if the Approval Coordinator has a result 'skipped' in the workflow context, it gets stuck and the workflow can not proceed to the next activity.


Steps to follow:

1. Gather the list of workflow conditions which do not have the "activity.result =='skipped" condition and whose Activity Definition is an "Approval Coordinator".

   Try this URL:

2. From the list view, update the condition column with the following line: activity.result == 'approved' || activity.result == 'skipped'

    This will ensure that the workflow will not get stuck for the new records.

Now, to fix the workflow contexts which are stuck on the Approval Coordinator, follow the below steps:

3. Get the list of workflow activities that are stuck and has a result value ‘skipped’.

You can use the below URL to grab the list:

4. From this list, we have to get the sys_id’s of the Workflow contexts that are stuck.

Run the below script in the Scripts-Background which will return a list of sys_id’s


var queryString = "result=skipped^state=finished^context.state=executing^activity.activity_definition=283e8bb80a2581021d036a052ffc3433"; 
var wh = new GlideRecord('wf_history'); 



Once we have the sys_id’s ready, we should run a Script that updates all the stuck workflow contexts and move the workflow.

Attaching “Script_for_ApprovalCoordinatorGotStuck_v2.js” to the KB article.

5. Run the attached script in the Scripts-Background which will fix the workflow contexts that are stuck.


> This script will be require to add a comma-separated list workflow context to be fixed under variable "contextList"
var contextList = "555a7e8a87311300a02fa1bb36cb0b80,855a3e8a87311300a02fa1bb36cb0be2";

> The workflows will be fixed after all records created under table ‘wf_command’ are processed.

> It takes some time for the script to update all the workflow contexts.

-Same steps to follow:

1. The script must be validated internally e.g.: using employee instance with a similar customer workflow (activities used) as possible. 

2. On customer side, the script must be validated on a test instance with a significative load of workflows contexts with the issue. 

3. Only after the script was successfully validated on a customer test instance then could be executed on a production instance.