Building a subflow means designing the called flow as a reusable component first, then wiring it into the parent. The steps below cover both halves of the work.
- Design the called flow as a component
Identify the reusable unit, like a validation, a notification pattern, or a record-prep step. Build it as a standalone Autolaunched or Screen flow. Keep its scope narrow so it stays reusable.
- Define input variables for what the subflow needs
On the called flow's Manager tab, create variables and mark them Available for input. Use clear names like recordId, sendEmail, contactList. Default values help when the parent does not assign every input.
- Define output variables for what the parent expects back
Create variables and mark them Available for output. Common outputs are isValid (boolean), errorMessage (string), createdRecordIds (collection of IDs the subflow inserted).
- Activate the called flow
A subflow only runs if it has an Active version. Activate the called flow before calling it from the parent, or the Subflow element shows an error at design time.
- Add a Subflow element in the parent flow
Drag a Subflow element into the parent. Pick the called flow by name. Assign input values from the parent's resources (variables, formulas, $Record). Pick which output variables the parent should store.
- Add a Fault path on the Subflow element
Drag the Fault path from the Subflow element to a handler: log to a custom object, set an error message, send an email alert. Without a Fault path, a faulting subflow takes the whole parent down.
Variables the subflow accepts. Must be marked Available for input on the called flow before the parent can assign them.
Variables the subflow returns. Must be marked Available for output on the called flow before the parent can capture them.
Optional path from the Subflow element that catches faults the subflow does not catch itself. Recommended on every Subflow element in production flows.
- Subflows always run the Active version of the called flow. There is no version pinning. Activating a new version of a subflow changes behaviour for every parent that calls it.
- Subflows share the parent's governor limits. A subflow with hidden SOQL inside a loop in the parent will multiply the parent's query count and hit the 100-SOQL limit fast.
- You cannot call a Screen flow from a Record-Triggered flow because there is no UI context. Use an Autolaunched subflow with output variables instead, and have the parent Screen flow render the result.