In this article, you’ll learn what is Parallel Flow Launcher, how to use it (basic functionality) and how to dynamically run many different sub-workflows in ServiceNow using the Workflow Coordinator.
1. What is Parallel Flow Launcher?
It’s a workflow activity which allows you to simultaneously run many sub-flows. It also allows you to handle inputs and outputs of the workflows which are running.
There’s a possibility to trigger another operation for each finished workflow using its output. The activity waits until all sub-flows are completed and then goes to the next step. To learn more, read the official documentation.
2. How to use it?
The basic configuration of this activity allows you to run one workflow multiple times with different input values. In the ‘Inputs field,’ you need to determine an array with parameter objects for each workflow. Then in the Workflow field set the workflow. See the example below:
3. How to dynamically run many different sub-flows?
What to do if the number of workflows, their inputs and names are unknown because they are handled by code or stored in some table? How to run these subflows?
In this case, we can use Workflow Coordinator. Firstly, we have to check ‘Advanced’ checkbox. Then we can type our code, where:
- coordinator – initialization of Workflow Coordinator,
- executed_item – array of objects. Each of them contains workflow name or sys_id and inputs values,
- add(input_variables, name_or_sysID_of_workflow) – method which sets subflow and its input variables.
See the example below:
If you are using Workflow Coordinator, leave Inputs field (mentioned at point 2) empty.
To get more information about other Workflow Coordinator method and functionality click here.