Workflow subflows

A workflow can create another child workflow in Gosu by using the scriptable createSubFlow method on Workflow. There are multiple versions of this method:

Workflow.createSubFlow(workflow)
Workflow.createSubFlow(workflow, version)

A subflow has the same foreign keys to business data as the parent flow. It also has an edge foreign key reference to the caller Workflow instance, accessed as Workflow.caller. (If internal code, and not some other workflow, calls a macro workflow, this field is null.)

Each workflow also has a subFlow s array that lists all the flows created by the workflow, including the completed ones. (This array is empty for workflows that have yet to create any subflows.) The Gosu to access this array is:

Workflow.SubFlows

You can use subflows to implement simple parallelism in internal workflows, which is otherwise impossible as a single workflow instance cannot be in two steps simultaneously. For example, it is possible for the macro flow to create a subflow in step A. It can then leave this subflow to do its own work, and only wait for it to complete in step E. It is your responsibility as the one configuring the macro workflow to decide how to react if a subflow drops into Error mode or becomes canceled for some reason.

See also