NOTE: We do not recommend using the Sub Flow Chart Action. Instead, we recommend using the Flow Chart Action, which provides the same functionality but does not include many of the risks inherent in the Sub Flow Chart Action. Refer to the sections below for further information on why the Flow Chart Action is the recommended method for deploying new flow charts to the engine from within another flow chart.
The Sub Flow Chart Action executes a flow chart within the context of a single action in another flow chart. The sub flow chart is run as though all of its actions and flows were contained in the parent flow chart - in effect, this makes the sub flow chart mainly an organizational tool, since it does not offer any functionality that could not also be achieved by running the actions and flows directly from the parent flow chart.
Because sub flow charts execute in the context of a single action on the parent, any operation to be performed on a sub flow chart (pause, expedite, remove, etc.) must be performed on the parent, rather than directly on the sub flow chart. See below for more information.?
The Sub Flow Chart Action is not recommended for use in most situations, due to the complex nature of the way the action executes within the parent. In almost all cases, we recommend using the Flow Chart Action instead, which offers a greater degree of control over the child flow chart.
When the sub flow chart executes, its name is derived from the name of the parent flow chart.
Sub Flow Charts and the Flow Context
When the sub flow chart begins executing, the current flow context is copied into the sub flow chart. If the sub flow chart is synchronous, once execution of the nested flow chart has completed, the sub flow chart's flow context is copied up to the parent flow chart. However, if a synchronous sub flow chart terminates with more than one active flow context, then no flow context is copied up to the parent flow chart, since there is more than one from which to choose.
Error Handling in Sub Flow Charts
If an error occurs within a synchronous sub flow chart and it is not handled there, the error is raised within the current flow chart and handled according to the normal flow chart error handling rules.
Transactions in Sub Flow Charts
If the sub flow chart is executed synchronously, the current transaction is committed as the action begins to execute, regardless of the transaction break property. On the other hand, if the sub flow chart is executed asynchronously, the current transaction is committed according to the usual Flux transaction semantics.
Performing Operations on Sub Flow Charts
To perform an operation (pause, remove, expedite, etc.) on a sub flow chart, you must perform the operation on the parent flow chart rather than directly on the sub flow chart action. This is because the sub flow chart action must run within the context of an action on the parent, and single actions in a flow chart cannot be directly controlled independent of the flow chart where they run.
So, for example, if you wanted to remove a sub flow chart running in a Sub Flow Chart Action on the flow chart "My Flow Chart", you would need to remove the entire "My Flow Chart", as the sub flow chart cannot be removed independently of its parent.
Note that this means that performing an operation on a sub flow chart will perform the same operation on all flow contexts running in the same parent flow chart at the time.
If you require the ability to perform operations only on the sub flow chart, or perform operations without affecting other flows in the parent, you must use the Flow Chart Action instead of the Sub Flow Chart Action.