Steps to resolve an Approval Coordinator issue where the workflow is stuck because of a missing condition "activity.result=='skipped'"Issue <!-- div.margin{ padding: 10px 40px 40px 30px; } table.tocTable{ border: 1px solid; border-color:#E0E0E0; background-color: rgb(245, 245, 245); padding-top: .6em; padding-bottom: .6em; padding-left: .9em; padding-right: .6em; } table.noteTable{ border:1px solid; border-color:#E0E0E0; background-color: rgb(245, 245, 245); width: 100%; border-spacing:2; } table.internaltable { white-space:nowrap; text-align:left; border-width: 1px; border-collapse: collapse; font-size:14px; width: 85%; } table.internaltable th { border-width: 1px; padding: 5px; border-style: solid; border-color: rgb(245, 245, 245); background-color: rgb(245, 245, 245); } table.internaltable td { border-width: 1px; padding: 5px; border-style: solid; border-color: #E0E0E0; color: #000000; } .title { color: #D1232B; font-weight:normal; font-size:28px; } h1{ color: #D1232B; font-weight:normal; font-size:21px; margin-bottom:-5px } h2{ color: #646464; font-weight:bold; font-size:18px; } h3{ color: #000000; font-weight:BOLD; font-size:16px; text-decoration:underline; } h4{ color: #646464; font-weight:BOLD; font-size:15px; text-decoration:; } h5{ color: #000000; font-weight:BOLD; font-size:13px; text-decoration:; } h6{ color: #000000; font-weight:BOLD; font-size:14px; text-decoration:; } ul{ list-style: disc outside none; margin-left: 0; } li { padding-left: 1em; } --> Symptoms The workflow gets stuck on the Approval Coordinator activity if the activity doesn't result in any approvals or if the approvers are Inactive. Cause 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. Resolution 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: https://instance_name.service-now.com/wf_condition_list.do?sysparm_query=name%3DApproved%5Eactivity.activity_definition%3D283e8bb80a2581021d036a052ffc3433%5Eactivity.workflow_version.published%3Dtrue 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: https://instance_name.service-now.com/wf_history_list.do?sysparm_query=result%3Dskipped%5Estate%3Dfinished%5Econtext.state%3Dexecuting%5Eactivity.activity_definition%3D283e8bb80a2581021d036a052ffc3433 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'); wh.addEncodedQuery(queryString); wh.query(); while(wh.next()) { gs.log(wh.context.toString()); } ******* 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. Note: > This script will be require to add a comma-separated list workflow context to be fixed under variable "contextList" e.g.: 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.