Conditional Routing: Switch Function Output to Set Nodes

Demonstrates using the Switch node to route Function-generated IDs to specific Set nodes, each setting unique values like 'n8n', 'nodemation', or 'nathan'. Ideal for learning branching logic in n8n.

n8n
Conditional Routing: Switch Function Output to Set Nodes

This workflow serves as a companion example for n8n's Switch node documentation. It begins with a Manual Trigger, followed by a Function node that outputs three items, each with a unique 'id' (0, 1, or 2). The Switch node then evaluates this 'id' value: routing to the first Set node for id=0 (setting 'name' to 'n8n'), the second for id=1 ('nodemation'), the third for id=2 ('nathan'), and a NoOp fallback for unmatched cases.

The primary benefit is illustrating dynamic conditional routing without complex coding, enabling scalable branching in automations. It showcases how Switch handles multiple outputs efficiently, processing each input item independently—key for batch operations.

Use cases include decision-tree automations like categorizing leads (e.g., route by score to different CRM actions), API response handling (branch by status codes), or data transformation pipelines where outputs vary by input type. Perfect for developers building enterprise-grade workflows in IT tools, saving hours on testing conditional logic.

$9.99
Last updated August 29, 2026
30-day money-back guarantee
Instant download
Lifetime updates included

New buyers can create an account from the cart to unlock a controlled $10 first-purchase credit on eligible orders of $25+.

Secure checkout powered by Stripe

Support

How to import this workflow into n8n

  1. 1Purchase or download the workflow to get the n8n workflow JSON file.
  2. 2In your n8n instance, open Workflows and choose "Import from File" (or paste the JSON with Ctrl+V on the canvas).
  3. 3Open each node marked with a credential warning and connect your own accounts and API keys.
  4. 4Run the workflow once manually to verify the data flow, then toggle it to Active.

Related Enterprise workflows

More from BestWorkflows

Need this deployed? We'll set it up for you.

Our automation experts deploy this workflow in your stack, connect your accounts, and verify it works — or build a custom solution from scratch.