Do the following in parallel flow logic
Summarize
Summary of Do the following in parallel flow logic
TheDo the following in parallelflow logic in ServiceNow allows you to run actions and subflows concurrently within separate paths inside a single isolated flow block. This enables multiple tasks to execute independently but within one flow execution context. While paths appear to run in parallel, they actually execute sequentially on a single thread, ensuring that if any action waits, others continue until all paths complete.
Show less
This flow logic is especially useful when you want to perform multiple independent actions simultaneously without blocking the flow. For truly separate execution contexts, dynamic flows are recommended.
Key Features
- Multiple paths: You can add multiple paths by clicking the plus icon, with each path containing its own actions or subflows.
- Independent execution: Actions and subflows in each path run concurrently until all complete, with outputs accessible only within their respective paths during execution.
- No direct inputs or outputs: The flow logic block itself does not have inputs or outputs, but contained actions and subflows can produce outputs accessible after the block completes.
- Execution context: Runs within a single-threaded flow execution context to conserve instance resources.
Practical Example
A common use case is creating multiple tasks in parallel when a change request is created. For example, two tasks can be generated simultaneously and assigned to different groups, each using the change request’s Number field for their short descriptions. This improves efficiency by handling multiple related operations concurrently.
Guidelines and Best Practices
- Avoid data dependencies between paths: Because paths may complete in any order, do not design paths that rely on data created or modified by other paths to prevent race conditions.
- Do not share data between paths: Workflow Studio restricts dragging data pills across paths to avoid uncertain output timing issues.
Execution Monitoring
During execution, the flow logic header displays the overall state, start time, and runtime. Each path’s state and timing details are also shown, helping you monitor progress and troubleshoot.
Run actions and subflows in separate paths within an isolated flow logic block.
With this flow logic, you can run actions and subflows in separate paths. If any action within the Do the following in parallel flow logic block must wait, other actions run until all paths within the block finish processing.
Inputs
Do the following in parallel flow logic does not have field inputs. Instead, it displays a plus () icon that enables you to create a path with actions or subflows.
The actions and subflows in each path run until all tasks within the flow logic block have completed.
Outputs
This flow logic has no outputs, but actions and subflows in each path may have outputs. While the flow is running, outputs from a path are only accessible to other actions in the same path. After the Do the following in parallel flow logic completes, its final outputs are accessible to the rest of the flow.
Create two tasks in parallel when a change request is created
In this example, a flow triggers when a new change request is created. Using Do the following in Parallel, two tasks are created in separate paths and are assigned to different groups. The flow uses the Number field data pill from the triggering change request to display the number in the short description for the task record.
Execution details
- The header shows the state, start time, and runtime for the flow logic.
- The Configuration Details section shows the state, start time, and runtime for each path in the flow logic block.
General guidelines
- Avoid creating data dependencies between paths
- Since a flow can run paths in any order, avoid creating data dependencies between separate paths. For example, do not have one path that creates a record and another path that updates the same record. The update record path may run before the create record path.
- Do not share data between paths
- Workflow Studio prevents you from dragging data pills between paths because the system cannot determine which path will finish first to supply the output value.