Parallel Merge

The Parallel Merge action allows you to merge multiple work items back into one.


Parallel routing is an advanced technique but very possible and very practical in certain situations. If you initiated multiple routes using the same parallel name then you use that same name to merge the items back together. This action type becomes the funnel point for bringing all the separate routes back together. You can have multiple Parallel Merge actions at various points with the same name all watching for the same split items. Once the last item is found for the given parallel name for the Record then the workflow will continue where you tell it to.


How the merge decides who is last

The Parallel Name is not just a label — it is the name of a data field on the Record, and that field is used as a live counter of how many parallel branches are still outstanding.


When an Initiate Workflow Route action starts a new route and has a Parallel Name filled in, it adds 1 to the field of that name on the Record. When a Parallel Merge action with that same name runs, it subtracts 1 from that field and then looks at the result. If the result is still greater than zero, other branches are still outstanding, so this branch is not the last one: the work item is cancelled and the workflow stops here for this branch only. If the result is zero, this branch is the last one: the counter field is reset to 0 and the workflow moves on to the trigger named in "If Last Go To", or simply continues from where it is if no trigger was given.


Because the counter is an ordinary Record field, you can see it on the Record while a parallel route is in flight, which makes parallel routing much easier to troubleshoot. A count that is sitting above zero with nothing active means a branch ended somewhere other than a merge. You can also pre-set or reset the counter with a Record Field Update action if you need to.


The safety check for cancelled branches

Counting alone would strand a Record if one of the parallel branches were cancelled by hand or by another action, because that branch would never reach a merge to decrement the counter and no branch would ever see zero.


To protect against that, whenever the decremented count is still above zero the engine also checks whether any other work items are active on the Record. If this work item is the only one left, it is treated as the last one regardless of what the counter says, and the workflow moves on normally. This means a partially cancelled parallel route will still complete rather than stall, though the counter field may be left holding a stale value.


Leaving the Parallel Name blank

If you leave the Parallel Name blank then no counter is used at all. The action simply checks whether any other work items are active on the Record: if there are, this branch is cancelled, and if this is the only active item, it is treated as the last one and the workflow moves on.


That makes a blank name mean "merge everything currently routed on this Record", including routes that have nothing to do with the parallel branch you had in mind, so use that option sparingly. Any named parallel route, any workflow started from an Add-In, and any route started by another trigger all count toward it.


Options

    • Parallel Name - Enter the name of the parallel route to merge. This must be the same name used in the Parallel Name option of the Initiate Workflow Route actions that started the branches. If you leave the name blank then this will treat ALL items that were routed for this Record as part of the parallel route, so use that option sparingly.


    • If Last Go To - The last item that was split and makes it to a Parallel Merge step for this Record and Parallel Name will trigger the workflow engine to move the Record to the defined trigger or process. You can either select a predetermined trigger from the list or you can use the name of a trigger (even one provided by a variable) to tell the system where to take the Record next. If a trigger name is supplied and a match is found, that match wins over the trigger selected in the list. If you do not select a "next" trigger then the workflow engine will just proceed from this trigger's location and move on from there.


All fields can contain static values or variables.


Things to watch for

Keep your increments and your merges balanced. Every branch that increments the counter should end at a merge that decrements it. If merges run more times than routes were started, the counter goes below zero, and because the engine only treats a count above zero as "others still outstanding", every branch arriving after that point will believe it is the last one and move the Record on.


Deferred routes do not increment the counter. When Initiate Workflow Route has Defer Actions turned on, the route is queued to run offline and the Parallel Name option is not used — the field is only shown and only applied when the route runs immediately. If you need parallel counting, start those routes immediately rather than deferred.


The counter field must hold a number. If the field ends up holding text that cannot be read as a number, the merge treats the branch as the last one and moves the Record on. Give the counter field a name of its own that no other process writes to.


The merge works on the active Record. Every branch of a parallel route is a work item on the same Record, which is what makes a single shared counter field possible, so Parallel Merge cannot be used to join work items that live on different Records.


Only the branch that turns out to be last continues. All the other branches have their work item cancelled at the merge, and no further actions in those branches run after the merge action.