About Branching and Merging Flows
  • Updated on 05 Mar 2019
  • 2 minutes to read
  • Print
  • Dark

About Branching and Merging Flows

  • Print
  • Dark

Branching and merging allows us to process multiple flow steps in parallel, rather than one after the other. You can create branches and mergers by dragging and dropping the Branch Step and Merge Step components to the Flow Designer work space, and structuring the steps which should be run in parallel between them.


In our example project, we will create a new flow to process four forms in parallel. First, we will navigate to our Designer Folder and click the Create Flow button.

Once we've named our new flow, select CREATE. The Flow Designer opens. 

Drag and drop the Branch Step and Merge Step from Steps > Flow Management to the work space. 
Any steps that are anchored between the Branch Step and Merge Step will run in parallel. However, this is not a true parallel. The steps will not run at the same time, but each step will be able to accept the same input and send their output to the steps with in their branch. To take advantage of this new structure, anchor multiple form interactions between the branch and merger.


In the Steps panel, navigate to Forms [Interaction] > [Current Folder] , and drag the previously created, elements to our Flow Designer work space: Form 1 , Form 2 , Form 3 and Form 4 . Keep in mind that in this use case, each form contains an Action button. The Branch Step offers anchors that can be connected to the inputs of our forms. 
Connect a Branch Step to the input of each form then, connect the output of each form to the Merge Step . This will merge the output of all four forms into one input for the end step. All we have to do now is connect our Start and End steps, and our Flow will be ready to test.

Stepping through the debugger, we can see how each form is presented in sequence. The debugger is accessed through the Debug Flow link. Each form's output is held at the Merge step until the other forms have been processed, after which all form data is combined and sent to the end step. 
Looking at the debugger, the forms receive input from the Branch Step. The Merge Step accepts the outputs of all four forms, merges them, and sends a single output to the end step.

Branching and merging can also be used in another scenario.

By selecting AllowCancelMerge , two inputs appear to configure within the Input properties**,** Cancel Pending Forms and Cancel Reason. Cancel Pending Forms is a boolean option that if set to true will cancel all pending forms that have not been satisfied yet. Cancel Reason is stored as a comment within a process folder if a process folder is being utilized. 
In the Merge Step Property Settings there are two Options for the Merge Type: This Flow Only andInclude Sub Flows. This Flow Only merges in the current flow. If sub flows are within the branch then, we may need to use the Include Sub Flows Merge Type . When using Include Sub Flows it is important to understand the Scope . For Example, we have a flow called Flow A . Flow A contains sub flowB , and Flow B contains sub flowC . If we use theInclude Sub Flows Merge Type in Flow B then, it will only merge in sub flow C.


Was this article helpful?