When to create a subflow
Create a subflow when the same sequence of steps appears in more than one flow, or when a sequence is logically self-contained enough to test independently. Good candidates: sending a notification, looking up a manager chain, creating a standard task.
Creating a subflow
- Go to Flow Designer → New → Subflow
- Name it clearly (verb + noun: "Send Approval Notification", "Get Manager Chain")
- Add Input Variables — these are the parameters the subflow receives
- Add Output Variables — the values the subflow returns to the caller
- Build the steps
Input and output variables
Input variables are required parameters the calling flow must provide. Output variables are values the subflow sets during execution that the calling flow can read afterward.
Example subflow: "Create Approval Task"
- Inputs: record_sys_id (Reference: Task), approver (Reference: User), due_date (Date/Time)
- Outputs: task_sys_id (String), task_number (String)
Calling a subflow from a flow
In the parent flow, add an Action step → Flow Logic → Run Subflow. Select your subflow and map the input variables using data pills from the parent flow context.
After the subflow runs, its output variables appear as data pills in the parent flow:
Trigger record → Run Subflow "Create Approval Task"
→ assign inputs from trigger data pills
→ use output: task_sys_id → in next step Update Record
Error handling in subflows
Subflows should handle their own errors where possible. Add Try steps around risky operations (REST calls, lookups that might return no results). If an error escapes the subflow, it surfaces in the calling flow.
Testing subflows independently
Subflows can be tested independently using the Test button in Flow Designer. Provide test values for all input variables and verify the outputs are correct before integrating into a parent flow.
Versioning considerations
When you modify a subflow, existing active flows continue using the version they were built with until you explicitly update them to use the new version. This prevents breaking changes from propagating automatically.