Call a subflow from a flow
Short answer
Define Inputs and Outputs on the subflow first, publish it, then in the parent flow choose Add Flow Logic → Call a Subflow, pick the subflow, and map a data pill into each input. The subflow's outputs then appear as pills for every step after it.
Where: Flow Designer → Add an Action, Flow Logic or Subflow → Flow Logic → Call a Subflow
Steps
1.Give the subflow typed inputs and outputs
Open the subflow, click the Inputs / Outputs tabs at the top and add each parameter with a type. Reference inputs (for example Reference → Incident) are better than raw strings because the parent flow then gets record pills instead of sys_id text.
2.Publish the subflow
A draft subflow does not appear in the parent's picker. Click Save → Publish. Republish after changing the input or output signature, otherwise the parent keeps the old mapping.
3.Add Call a Subflow in the parent flow
In the parent flow: Add an Action, Flow Logic or Subflow → Flow Logic → Call a Subflow. Select your subflow by name; the Inputs panel populates from the subflow signature.
4.Map data pills into the inputs
Drag the trigger record, a lookup result, or a flow variable into each input. Required inputs must be filled or the flow errors at runtime, not at design time.
5.Choose synchronous or asynchronous
Leave the default (synchronous) when downstream steps need the subflow's outputs. Set it to run asynchronously only for fire-and-forget work — asynchronous calls return no outputs to the parent.
6.Consume the outputs
In any later step, open the pill picker and expand the Call a Subflow step to use its outputs. If you need those values inside a script, pass the pill into a declared Script step input.
(function execute(inputs, outputs) { // inputs.subflow_result was mapped from the subflow's output pill outputs.is_approved = inputs.subflow_result === 'approved'; })(inputs, outputs);
Common mistakes
- Calling a subflow that is still in Draft — it will not show in the picker. Publish it.
- Expecting outputs from an asynchronous subflow call. Asynchronous means the parent moves on immediately and gets nothing back.
- Changing subflow inputs without reopening the parent flow: the parent keeps the stale mapping until you re-select the subflow.
- Deep nesting. Subflows can call subflows, but every level adds execution context — keep it to two levels for anything you have to debug in production.
- Using a subflow where a custom Action fits better. Actions are for reusable single operations, subflows for reusable multi-step processes with their own logic.
FAQ
What is the difference between a subflow and an action in ServiceNow?
An Action is one reusable operation built from steps (script, REST, record lookup) and is exposed in the action picker. A subflow is a reusable flow — it can contain flow logic, approvals, waits and multiple actions — and is called with Flow Logic → Call a Subflow.
Can a subflow return values to the parent flow?
Yes, through its declared Outputs, as long as the call is synchronous. Asynchronous subflow calls do not return data.
Can I call a subflow from a script?
Yes — use sn_fd.FlowAPI.getRunner().subflow('scope.subflow_name').inBackground().withInputs({...}).run() from server-side script. Inside Flow Designer itself, prefer the Call a Subflow flow logic.