Module 5 Lesson 5: Global Workflows
·Automation

Module 5 Lesson 5: Global Workflows

Libraries of logic. Learn how to create 'Sub-Workflows' that can be called by multiple other workflows, making your automation standard and easy to maintain.

Module 5 Lesson 5: Global Workflows

Just like "Templates" in GitLab (Course 9), n8n has Sub-Workflows. If you use the same "Calculate Insurance Tax" logic in 5 different workflows, don't build it 5 times. Build it ONCE and use the Execute Workflow node.

1. The "Parent" and "Child" Model

  • The Child: A workflow that starts with an "Execute Workflow Trigger". It does the hard work and returns data.
  • The Parent: Your main workflow. It uses the "Execute Workflow" node to "Call" the child.

2. Passing Data

When you call a child workflow:

  1. You "Pass" items from the parent.
  2. The child sees these items as if they came from its first node.
  3. The child finishes and "Hands back" the result to the parent.

Visualizing the Process

graph TD
    Start[Input] --> Process[Processing]
    Process --> Decision{Check}
    Decision -->|Success| End[Complete]
    Decision -->|Retry| Process

3. Why Use Modular Workflows?

  • Maintenance: Need to change the tax rate? Update 1 child workflow, and all 5 parents are fixed.
  • Speed: You can build a huge, complex system by just "Wiring together" small, tested components.
  • Organization: Your canvas stays "Clean." You don't have 100 nodes in one view.

4. Error Handling at Scale

You can wrap an Execute Workflow node in its own "Try/Catch" logic.

  • "Call the 'Charge Credit Card' sub-workflow."
  • "If it fails, call the 'Notify Customer' sub-workflow."

Exercise: The Architect's Design

  1. Create a "Calculator" child workflow. It should take a number and multiply it by 10. (Use an Execute Workflow Trigger).
  2. Create a "Main" workflow. Add an Execute Workflow node that calls your Calculator.
  3. Pass the number 5 to it. Run the Main workflow. Did you get 50 back?
  4. Research: Can you call a workflow that lives on a DIFFERENT n8n server? (Hint: Use the HTTP Request node and the n8n API).
  5. Why is this better for a team of 5 people than everyone building their own "Slack notification" logic?

Summary

You have completed Module 5: Advanced Logical Flow. You now know how to handle complex decisions, batch heavy loads, catch errors, loop through items, and build modular, reusable architectures. You are officially an n8n Power User.

Next Module: Talking to the world: Module 6: Connecting to APIs and Webhooks.

Subscribe to our newsletter

Get the latest posts delivered right to your inbox.

Subscribe on LinkedIn