The Parallel Flow Launcher activity launches multiple subflows in parallel.

Workflows running in parallel execute simultaneously and may complete in any order. The activity can launch a single subflow or multiple subflows as needed. You can manage the input values and values returned for each subflow.
Note: The Parallel Flow Launcher activity waits until all subflows are completed before proceeding. If any subflow does not finish, the activity waits indefinitely.

Do not launch a large number of subflows with the Parallel Flow Launcher activity. If overused, this activity can overburden the instance. For launching very large numbers of subflows, consider putting the Parallel Flow Launcher inside a loop controlled by a turnstile or other conditional activity and having it do batches.

Activity variables

Activity variables determine the initial behavior of the activity.

Table 1. Parallel Flow Launcher activity input variables
Field Description
Parallel Flow Launcher configuration
Name A unique name for the activity.
Stage The stage to display when the workflow reaches the activity.
Inputs Inputs to the subflows to run. Specify an array of name: value pairs for each input defined in the workflow being launched. The name and data type of each input variable entered must match those used by the subflow that this activity launches. For a detailed example, see Parallel Flow Launcher Example.
Parallel Flow Launcher selection
Workflow The workflow to run.
Advanced Check Advanced, to enter a script that uses a WorkflowCoordinator object to manage the subflows. When you check Advanced, a text box appears where you can enter a script that specifies a unique workflow for each set of input variables. See WorkflowCoordinator object for more information.
Parallel Flow Launcher iteration

Specify parameters to tune the performance of batched workflows.

Count If not specified by an input set, Count determines the number of subflows executed in parallel from this activity. If the Advanced option is not selected, ensure that this field is populated with a valid number.
Max flows The maximum number of workflows this activity can launch. If this value is a positive integer, it overrides the max parameter used in the WorkflowCoordinator constructor.
Max simultaneous The maximum number of parallel workflows this activity can run at one time. If this value is a positive integer, it overrides the poolsize parameter used in the WorkflowCoordinator constructor.
Parallel Flow Launcher Process
Process flow complete To specify a script that runs after each subflow completes, check Process flow complete. If you check this field, a text box labelled Flow complete appears, where you can enter the script to run.
Flow complete The script that runs each time a subflow finishes. This field is available when the Process flow complete option is selected.

The same script functions and variables available in other workflow scripts, such as those in the Run Script activity, are available here. For more information, see Completed subflow values in scripts.

The variable "flow" is available to this script. It is an object that contains the following information about the flow that is finishing:

flow.output (String): The value that the subflow returns to the parent if it executed a Return Value activity before ending.

flow.index (Number): The zero-relative index of the subflow that finished.

flow.contextId (String): The sys_id of the workflow context for the completed subflow.

flow.inputs (Object): The inputs that were passed to the subflow when its context was created and started.

flow.status (String): The final state of the context. This corresponds to the state column in the subflow context record, which has possible values of executing, finished, cancelled, or faulted. (Since the flow is completed, it cannot be executing at this point.)

Parallel Flow Launcher Split
Process finished To specify a script that runs after all subflows have finished, check Process finished. If you check this field, a text box labelled Finished Scriptappears where you can enter the script to run. The ‘coordinator’ variable is made available to this script and is an object that allows access to any of the finished subflows using the getFlow(index) method. For example:
for (var i = 0; i < coordinator.getNumFlows(); i++) 
writeFlowResultsToTable( i, coordinator.getFlow(i) );
Finished script The script that runs after all subflows launched by the activity are complete. You can use variables that contain completed flow information in this script.

The ‘coordinator’ variable is made available to this script and is an object that allows access to any of the finished subflows using the getFlow(index) method. For example:

for (var i = 0; i < coordinator.getNumFlows(); i++) 
writeFlowResultsToTable( i, coordinator.getFlow(i) );
This field is available when Process finished is selected.

States

The activity state tells the workflow engine what to do with the activity. To view an activity's state, point to the activity. A pop-up window shows the State and Result of the activity. If the activity is in an error state, the pop-up window provides a brief Fault Description.

Table 2. Parallel Flow Launcher activity states
State Description
Waiting The activity is waiting for all subflows to finish. All subflows have started and some may have finished.
Finished The activity successfully completed all of the subflows.
Error The activity encountered an error.