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.

What Is a Sub-Workflow?

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.

When to Use Sub-Workflows

Sub-workflows are useful when:

  • A piece of logic is reused across multiple workflows. Instead of duplicating nodes in three different workflows, you build the logic once as a sub-workflow and call it from each one.
  • A workflow is getting too long to manage. Breaking it into a main workflow plus specialized sub-workflows keeps each piece focused and easier to update.
  • You want to isolate logic that might change. If the credit check process changes, you update one sub-workflow instead of finding and editing every workflow that includes it.

Common examples in manufacturing and distribution:

  • Credit check sub-workflow: Your main order workflow calls this sub-workflow for any order above a certain value. The sub-workflow checks the customer's credit status and returns a result. The main workflow uses that result to route the order.
  • Supplier onboarding sub-workflow: Any workflow that adds a new supplier (from an Airtable trigger, a form submission, or a webhook) calls this sub-workflow to run the standard onboarding steps: create ERP record, send intro email, assign internal owner.
  • Slack notification sub-workflow: A standardized notification workflow that accepts a message and a channel name. Any workflow in your n8n instance that needs to send a Slack alert calls this one instead of each configuring its own Slack node.

How to Set Up a Sub-Workflow

Step 1: Create the Sub-Workflow

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.

Step 2: Build the Logic

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.

Step 3: Add the Execute Sub-workflow Node to the Calling Workflow

In the main workflow, add an Execute Sub-workflow node where you want to call the sub-workflow. Configure it to:

  • Select the sub-workflow you created
  • Map the input fields from the current workflow to the fields the sub-workflow expects

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.

A Practical Example

Main workflow: Order Processing

  1. Trigger: On App Event (Shopify, On Order Created)
  2. Condition: Is the order value above $5,000?
    • True path: Execute Workflow (Credit Check sub-workflow), pass in customer ID and order value
    • False path: Continue to standard fulfillment routing
  3. After Credit Check sub-workflow returns:
    • If approved: route to fulfillment
    • If flagged: hold order and notify finance in Slack

Credit Check sub-workflow:

  1. Trigger: When Executed by Another Workflow (receives customer ID and order value)
  2. Looks up customer credit status in ERP (via HTTP Request node or ERP connector)
  3. Returns: approved or flagged, plus credit limit

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.

Testing Sub-Workflows

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.

Where to Go Next

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.

Scaling Beyond Individual Workflows

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.