Best practices for using subflows
Follow these best practices when using subflows.
Send a JSON Response for the subflow’s end state
If the subflow completes successfully, end the subflow with an HTTP node set to the Send Success JSON Response capability. In the parent flow, the flow conductor node that launched the subflow then evaluates to true.
If the subflow completes unsuccessfully, end the subflow with an HTTP node set to the Send Error JSON Response capability. In the parent flow, the flow conductor node that launched the subflow then evaluates to false.
The Send Custom JSON Response capability is not recommended for use in subflows. If a subflow ends with a node using this capability, the flow conductor node that launched that subflow always evaluates to true. If you plan to use a custom JSON response to conclude a subflow and you need to return a success or error condition, use a variable to store the condition, then use an evaluation node in the parent flow if you need to make branching decisions based on the variable’s value.
For example, to use a custom variable in that HTTP node to indicate that the use case is an error response, use IS_MFA_Required_Response=false
.
Use styling rules from the parent flow
Avoid defining CSS in a subflow. Instead, use the styles defined in the parent flow.
Minimize the number of layers (subflows calling other subflows)
Because each subflow has a performance cost, avoid solutions that require subflows to reference other subflows. Don’t exceed five levels of depth. Instead, design a single parent flow that references multiple subflows in sequence.