You can manage your workflows better by breaking up a large automated process into multiple, smaller workflows. The Run Child Workflow module is a way to reference one or more child workflows from a parent workflow. At the step where this module is added in, the parent workflow will pause and wait for the specified child workflow to return its output value before continuing.
Another reason to use child workflows would be if you have multiple starting points that end with the same process. In this case you would make multiple parent workflows that all trigger the same child workflow before continuing or ending.
Create a parent/child relationship:
- Open the parent workflow and add the Run Child Workflow module.
- In this module’s setup panel, set the name of the child workflow it should trigger under Child Workflow Name.
- Save this workflow.
Now if you navigate to the child workflow and click on its Trigger, you will see the name of the parent workflow listed in the Trigger panel.
Example of a parent and child workflow
Here are two chat-based workflows:
The initial parent set up
After the ParentWorkflow has been triggered by the phrase Start Parent, the Add Comment module is set up to state that you are currently in the parent workflow.
The Child Workflow module is then added into this parent to bring you over to a separate workflow, titled ChildWorkflow.
The child workflow set up
The workflow called ChildWorkflow only has one state. This state outputs a message saying that you are in the child workflow and asks what data it should send back to the parent workflow.
NOTE: the sys-any context allows it to accept any input entered.
The parent workflow’s final state
The last state in the parent workflow is set to output a message saying you are back in the parent workflow, along with the data entered while in the child workflow.
Example of a completed run
This is how it would look when running both workflows by triggering the parent: