As workflows grow, they get harder to manage. A single workflow that handles order intake, routes based on value, checks credit, sends Slack alerts, updates the ERP, and notifies the sales team is technically possible, but it becomes difficult to test, update, and troubleshoot.
Sub-workflows solve this. Instead of one large workflow doing everything, you build specialized workflows for specific tasks and call them from a main workflow when needed.
This post covers how sub-workflows work in n8n, how to set them up, and when they are worth using.
A sub-workflow is a regular n8n workflow that uses the When Executed by Another Workflow trigger. That trigger tells n8n: this workflow does not run on its own. It only runs when another workflow calls it.
The workflow that calls it uses the Execute Workflow node to pass data to the sub-workflow and (optionally) receive data back.
Sub-workflows are not a separate feature in n8n. They are just workflows designed to be called from other workflows.
Sub-workflows are useful when:
Common examples in manufacturing and distribution:
Create a new workflow and set the trigger to When Executed by Another Workflow. This is the only trigger this workflow needs.
The "When Executed by Another Workflow" node also lets you define what input data you expect. You can specify the fields the calling workflow should pass in, which makes the interface between the two workflows explicit and easier to debug.
Build out the workflow logic as you normally would. The data passed in from the calling workflow is available through the trigger node, just like data from any other trigger.
If you want to return data back to the calling workflow, the output of the last node in the sub-workflow is what gets returned. Keep this in mind when you structure the final node.
In the main workflow, add an Execute Sub-workflow node where you want to call the sub-workflow. Configure it to:
The Execute Sub-workflow node can run the sub-workflow and wait for it to finish (synchronous), or fire it and continue without waiting (asynchronous). For cases where you need the sub-workflow's output to decide what happens next, use the synchronous option.
Main workflow: Order Processing
Credit Check sub-workflow:
The main workflow stays focused on intake and routing. The credit check logic lives in its own workflow, can be tested independently, and can be updated without touching the main flow.
You can test a sub-workflow independently by temporarily adding a Trigger Manually trigger, running it with sample data, and confirming the logic works. Once tested, remove the manual trigger and leave only the When Executed by Another Workflow trigger.
When testing the full chain, use the execution log in n8n to trace how data moved between the calling workflow and the sub-workflow.
Sub-workflows use the When Executed by Another Workflow trigger, which is one of eight trigger types in n8n. For a full breakdown of all eight and when to use each one, see n8n Triggers: What They Are and How to Pick the Right One.
If you are evaluating whether a process should be automated with n8n or Shopify Flow, Conditional Logic Automations: When to Use n8n vs Shopify Flow covers the decision framework.
Sub-workflows are one way to keep a growing automation program manageable. The deeper challenge is building the program itself: knowing which workflows to automate first, how to document what you build so others can maintain it, and how to sequence builds so each one adds to the last.
The FlowKaizen guide covers the full system for operations teams running automation as a program rather than a series of one-off projects.