- Fix Guides
- How to Fix ServiceNow Flow Designer Flows Stuck in Running State
How to Fix ServiceNow Flow Designer Flows Stuck in Running State
Step-by-step fix guide with AI-powered diagnosis from BuildForce.
ServiceNow Flow Designer flows get stuck in Running state when a Wait for Condition step's condition never becomes true (often due to a referenced field being removed), a subflow's parent transaction is killed but the subflow continues independently, or the platform's transaction timeout kills the executing thread while the flow context remains. The fix: query sys_flow_context where state='executing' and started before LAST_N_HOURS:24, manually cancel via the Flow Operations Status UI or set state='cancelled' programmatically, and audit Wait conditions for references to deleted fields.
Symptoms
Flow Operations Status showing 'executing' for flows started days ago
Subflows continuing to run after their parent flow was cancelled
Same flow firing on every record save but never completing
REST API trigger returning 200 but the flow never reaches the action steps
Approval-based flows hanging when the approver leaves the company
Scheduled flow showing 'running' on every scheduled run with overlapping executions
Root Causes
Wait for Condition referencing a deleted field
A 'Wait until incident.assigned_to.department = X' step where the department field has been removed evaluates to perpetually false. The flow waits indefinitely because the condition can never be satisfied.
Transaction maximum execution time exceeded mid-flow
ServiceNow has a default transaction quota (typically 5 minutes). If a flow step exceeds this, the thread is killed but sys_flow_context still shows 'executing'. The flow doesn't recover — it sits in a zombie state until manually cancelled.
Subflow orphaned when parent cancelled
Cancelling a parent flow doesn't automatically cancel its called subflows. Subflows continue with their own context, often waiting for conditions that the parent would have satisfied. They run until they hit their own timeout or are manually cancelled.
Approval action where approver is inactive
If a flow has an Ask for Approval action and the approver becomes inactive, the flow waits at the approval step indefinitely. No automatic re-routing happens unless the approval action explicitly defines a fallback approver.
REST API call in flow timing out without retry config
A flow step that calls an external REST API can hang waiting for a response that never comes if no timeout is configured. The flow context stays 'executing' for the platform's max transaction time, then becomes a zombie.
How to Fix It — Step by Step
List all stuck flow contexts
Query sys_flow_context for state='executing' with sys_created_on more than a few hours ago. These are your candidates for cancellation. The longer the duration, the more confidently you can cancel them.
// Filter by URL or query in Studio
sys_flow_context.list?sysparm_query=state=executing^sys_created_on<javascript:gs.daysAgoStart(1)&sysparm_fields=name,state,sys_created_on,operationUse Flow Operations Status UI to cancel individually
Navigate to Flow Designer → Operations Status. Filter by State = Executing. For each stuck flow, click the context and use the 'Cancel' button. This handles cancellation cleanly including event cleanup.
Bulk cancel via background script for large backlogs
For dozens or hundreds of stuck contexts, use a background script (Studio → System Definition → Scripts - Background). Be cautious: confirm via list query first, then run the cancellation.
var gr = new GlideRecord('sys_flow_context');
gr.addQuery('state', 'executing');
gr.addQuery('sys_created_on', '<', gs.hoursAgoStart(24));
gr.query();
while (gr.next()) {
gr.state = 'cancelled';
gr.update();
gs.info('Cancelled: ' + gr.name);
}Identify the failing step
Open the stuck flow context's Execution Details. The last 'started' step with no 'completed' timestamp is where it hung. Common patterns: Wait for Condition (broken condition), Ask for Approval (inactive approver), REST step (timed-out external call).
Fix Wait for Condition references
Edit the flow and inspect each Wait step. Confirm every field referenced still exists and has the expected type. Add a maximum wait duration to every Wait step (default is infinite) so future hangs eventually fail rather than persisting forever.
Configure approval fallback for human-in-the-loop steps
On every Ask for Approval action, set a fallback approver or a 'Re-approve if approver is inactive' setting. Without this, departing employees create permanent flow hangs that require manual remediation.
Set REST step timeouts and retry policy
For every REST or third-party API step in a flow, set an explicit timeout (typically 30-60 seconds) and retry policy (3 attempts with exponential backoff). This prevents external hangs from blocking the flow indefinitely.
Let BuildForce diagnose and fix this automatically
Instead of following manual steps, connect your org and let our AI identify exactly what's broken and how to fix it — in minutes.
Book a DemoCommon Questions
More answers about this issue and how to resolve it.
Stop debugging manually. Let AI do it.
BuildForce runs 200+ automated checks across your Salesforce org and tells you exactly what's broken and how to fix it.