Branching
Use these best practices when creating branches within a flow.
Build the main path along the top
The most common success path should continue in a straight line to the right from the starting node. Alternate paths and error messages should branch downward from the main flow.
For example, consider the following flows. They are identical aside from layout and annotations:
Success path along the top (recommended):
Success path moving up and down (not recommended):
Branch flows using one logical operator per node or exit path
A logical operator is the circular branching point that is automatically created when you join one node to another. When you create a branch in a flow, make sure that there is exactly one logical operator per node or exit path.
If you branch after a simple node, the branches should all emerge from a single logical operator:
Branch originating from logical operator (recommended):
Branches originating from connector (not recommended):
If you are branching from a node, such as a Functions connector node, that has multiple exit paths, use one logical operator for each exit path:
Branches using one logical operator per exit path (recommended):
Branches using one logical operator for multiple exit paths (not recommended):
Branch using All true and Any false
If creating a true/false branch, you should select the All Triggers True option for the true branch and Any Trigger False for the false branch.
When you duplicate multiple nodes, the connecting option might default to All Triggers True in the duplicated nodes. Verify that the option is correct after you duplicate nodes. |
Merge branches with common data using flow instance variables
When branches that perform similar tasks converge, you can make sure you reference the data from the correct branch by setting a flow instance variable to contain the data. Nodes that come after the flow converges can reference the flow instance variable.
This solution applies where the flow branches on a choice and can follow one path or the other, then converges back together. If your flow has similar data in parallel branches that run simultaneously, you don’t need a flow instance variable.
Don’t build flows with simultaneous UI paths
When branching a flow, make sure that the user can only encounter one user-facing node at a time. If the flow moves down multiple paths with UI nodes, some of these nodes will not display correctly.
Merge parallel branches using All triggers complete
When merging branches that are executing in parallel and you want to be sure that both have completed their work, merge both branches into a connector with the All Triggers Complete option.
Branch before Teleport nodes
When using the Teleport connector’s Go to Start Node or Return to Calling Node capabilities, branch before the node, not after. Branching after a Teleport connector that is configured to send the flow progression to a start node or calling node can skew your Flow Analytics data.
Branching before teleporting (supported):
Branching after teleporting (not supported):
Use Teleport nodes for looping flows
When flows loop, the canvas can become cluttered with looping lines that make the flow hard to understand. To avoid this, use the Teleport connector. Define a start node at the point where the loop returns, and then use the Teleport connector to go to that start node to execute the loop.
Teleport nodes (recommended):
Looping (not recommended):
If your flow loops, you might want a field in one node to include a value from a node further to the right. When you are configuring the value for a field, you can enable the Show all nodes option to show values from all nodes, not just nodes to the left of the current node. |
Keep Teleport destination nodes simple
Configure the logical operator that immediately follows a destination Teleport node to All Triggers True.
Make sure there is a one-to-one relationship between the teleport destination node and the node that follows it. You don’t want to branch the flow immediately after the teleport destination node, and you should reuse teleport destination nodes rather that creating multiple destinations that lead to the same following node.
Handle all potential false branches
If a node returns a false result but does not have a false branch as an output, the flow will fail, presenting a confusing experience for the end user and a challenge for troubleshooting.
To prevent this issue, you should make sure any node that can return a false result has a false output that presents an error message.