How Branching and Merging WorksLast Updated: 12/05/2018 Introduced in Version:
Branching and Merging is the process that use in Decisions to allow a flow to run multiple steps at the same time. This is commonly used in very specific examples. When there are multiple people that want to work on the same workflow/work item at the same time. Or, an invoice that needs three different people to provide their approval at the same time.
The flow can either assign that to one person, wait for them to work it, assign it to the next person, wait for them to work it and so on or the flow can run in parallel by branching. It can run three steps at the same time, assigning three different workflow activities to three different people.
*Note: Branching and Merging was designed to have simultaneous async steps waiting for work to be done. In a straight branching and merging configuration steps are still run sequentially it’s just that it will run all the steps and let them all wait at the same time.
There are a pair of steps used in Branching and Merging, one of them creates the multiple threads of execution.
There are two primary ones:
- Define branching step. Where you define a number of different branches representing different threads of execution.
- Branch For Each step where it passes in a list and will create a branch to execute for every item in that list and will run that same item through the set of steps. But it will be done for each of those items.
When the execution of a branch and merge is done there is a merge step, that step will wait for all of the threads of execution to complete before moving on to the next step in the process.
*Note: Merging can also be used to cancel all the other parallel paths being waited on.
The merging step has an option to factor in certain conditions for instance: branch out five different approvals but only need two people to approve it, the merge step will then cancel the tasks for the other people so they do not have to approve it anymore.