Go back to flow logic
Summarize
Summary of Go back to flow logic
The "Go back to flow logic" feature in ServiceNow's Flow Designer allows users to return to a previous step in a flow, enabling the repetition of actions as needed. This functionality is available starting from the Washington DC release onward and is not compatible with flows created in earlier versions.
Show less
Key Features
- Placement Restrictions: "Go back to flow logic" can only be added within specific sections of a flow, such as branches of If, Else If, Else, decision-making, or try logic. It must not be placed within error handlers.
- Target Step Conditions: A valid target step must be prior to the "Go back to flow logic," not in a different branch, and must not be within the same branch unless it belongs to a child logic block.
- Loop Management: Selecting a target outside the parent flow logic resets the loop iteration count. Separate counters are maintained for the "Go back to" and its parent loop.
Key Outcomes
By properly implementing "Go back to flow logic," users can enhance the flexibility of their workflows, allowing for error handling and conditional looping. It is essential to avoid infinite loops and duplicate steps to ensure optimal flow performance. Users are advised to finalize the flow structure before adding this logic and to monitor loop conditions to prevent excessive iterations.
Return to a prior step in the flow to repeat a sequence of actions.
Family release requirements
You can only add Go back to flow logic to new flows created from the Washington DC family release and forward. Flows that were created in versions prior to the Washington DC family release do not support Go back to flow logic.
Valid Go back to placement
- The Go back to flow logic must be within a branch of a parent flow logic block.
- Then branch of If, Else If, or Else flow logic
- Answer branch of Make a decision flow logic
- Catch branch of Try flow logic
- The Go back to flow logic must be outside of the Error handler section.
Valid Go back to target step
- The target must be a step before the Go back to flow logic.
- The target can't be a step within a different branch of the flow.
- The target can't be a step within the same branch as the Go back to flow logic.
- The target can't be a step within a non-branching flow logic block unless the non-branching flow logic block also includes a child Go back to flow logic.
- The target can be a step outside of a non-branching flow logic block except for Do the following in parallel flow logic.Warning:Selecting a target step outside of a parent flow logic block exits the current loop and resets its loop iteration count. The system displays separate loop iteration counters for the Go back to loop and the parent flow logic block. All loops are limited by the maximum number of loop iterations property (sn_flow_designer.max_iterations).
Inputs
| Input | Description |
|---|---|
| Go back to step | Step in the flow that meets the conditions of a Go back to step target. |
Go back to start of flow
In this example, the flow goes back to the first step when the approval task for the trigger record is rejected. Valid Go back to targets include steps 1, 2, and 3. Step 4 violates rule 2 as it's a step within a different branch. Steps 5 and 6 violate rule 3 in that they're steps within the same branch of the flow.
Outputs
This flow logic has no outputs.
General guidelines
Use these general guidelines when adding Go back to flow logic.
- Add Go back to flow logic after the flow structure is complete
- Go back to flow logic depends on a fixed sequence of steps to function properly. Wait to add Go back to flow logic until the flow has valid target steps.
- Avoid creating duplicate Go back to steps
- A flow uses the first Go back to flow logic whose conditions are met. The flow ignores all Go back to flow logic steps after the first.
- Avoid creating infinite loops
- Specify a condition to resume the flow or to throw an error with each Go back to loop. Error and resume conditions prevent a flow from running until it reaches the maximum number of loop iterations (sn_flow_designer.max_iterations property). You can use an If flow logic to check for loop end conditions. For example, create a flow variable that counts how many times the flow has run the Go back to flow logic. When the flow variable reaches a limit, end the flow.
- Delete Go back to flow logic to move it
- After you add Go back to flow logic, you can't move it to another location. You can only delete it from its current location and then add it to another valid location.