Sign In

Sub-Workflow

Execute another workflow as a child step with input/output mapping, fire-and-forget, and run-per-item modes.

The Sub-Workflow node invokes a separate workflow as a child execution. Use it to compose reusable workflow modules, fan out processing across items, or trigger background jobs without waiting for results.

Configuration

FieldTypeRequiredDescription
workflowIdstringYesThe ID of the child workflow to execute.
executionModeenumNoHow the child workflow runs. One of waitForCompletion (default), fireAndForget, or runPerItem.
itemsSourcePathstringWhen mode is runPerItemVariable path to the array of items. Each item is passed as _item to the child workflow.
inputMappingMappingRow[]NoMaps parent workflow variables to child workflow input keys. Each row has a parentVariable (template expression) and a childKey (plain string).
outputMappingOutputMappingRow[]NoMaps child workflow output keys back to parent variable names. Each row has a childKey and a parentKey. Hidden when mode is fireAndForget.
timeoutnumberNoTimeout in milliseconds for child execution. Range is 1000 to 300000. Defaults to 60000 (60 seconds).
maxDepthnumberNoMaximum nesting depth for sub-workflow calls. Range is 1 to 10. Defaults to 3. Prevents infinite recursion.

Execution Modes

Wait for Completion -- Starts the child workflow, blocks until it finishes, and returns its output to the parent via the output mapping.

Fire and Forget -- Starts the child workflow and immediately continues the parent workflow without waiting. No output mapping is available in this mode.

Run Per Item -- Iterates over an array of items and executes the child workflow once per item, passing each item as _item. Waits for all executions to complete and returns an array of results.

Recursion Protection

The engine tracks a workflow chain across nested sub-workflow calls. If the same workflowId appears twice in the chain (circular reference), execution is halted with a CYCLE_DETECTED error. The maxDepth setting provides an additional guard against deep nesting.

Output

FieldTypeDescription
executionIdstring or nullID of the child execution. null for fire-and-forget mode.
statusstringStatus of the child execution (e.g., COMPLETED, STARTED).
isCompletebooleanWhether the child workflow finished.
modestringThe execution mode that was used.
resultsarrayArray of per-item results. Only present in runPerItem mode.
itemCountnumberNumber of items processed. Only present in runPerItem mode.
(mapped keys)variesAny keys defined in the output mapping are merged into the top-level output.

Example

Reuse an "Enrich Contact" workflow for each lead in a batch.

Workflow ID: wf_enrich_contact_abc123
Execution Mode: Run Per Item
Items Source: {{httpRequest_1.body.leads}}
Input Mapping:
  {{httpRequest_1.body.apiKey}} -> apiKey
Output Mapping:
  enrichedData -> enriched
Timeout: 120000
Max Depth: 2

After execution, subWorkflow_1.results contains an array of enrichment results, one per lead.

On this page

Sub-Workflow | Buildorado