Switch Node

Route your workflow by matching one expression value to named cases.

The Switch node evaluates a single expression once, then routes to the first case whose value matches. If nothing matches, it takes the Default branch.

Use Switch when you are routing on a value (status, type, decision). Use Condition when you need boolean checks (score >= 90, items.length > 0).

How it works

                    ┌─ case "paid"     → Branch A
Start → … → Switch ─┼─ case "pending"  → Branch B
                    └─ default         → Branch C

Each case (and Default) has its own output handle. Connect a downstream node to each path you care about.

Switch on

Switch on is a JavaScript expression. It is evaluated once in the same sandbox as Condition nodes, then compared to each case value.

Available in the expression:

NameMeaning
lastOutputOutput of the previous node
inputsOriginal trigger / start payload
variablesWorkflow variables
contextPrior node outputs keyed by node id

You can also insert {{…}} templates (Variables button), same as elsewhere in the editor.

Examples

lastOutput.status
lastOutput.decision
inputs.eventType
context['ai-classify'].output.category
{{lastOutput.sentiment}}

The default when you add a Switch node is lastOutput (the whole previous output). Prefer a field path like lastOutput.status so case values stay simple strings.

Matching rules

  1. Evaluate Switch on → get a value.
  2. Coerce that value to a string (null/undefined""; objects → JSON.stringify).
  3. Walk cases in order; first case where String(caseValue) === String(switchValue) wins.
  4. If none match, take Default.

Case values are plain text you type in the panel (e.g. paid, PASS, customer_action) — not expressions.

Configuring cases

FieldBehavior
CaseLabel (optional) + match value (required)
DefaultRuns when no case matches

Add cases with Add Case. Connect each handle on the canvas to the correct next step.

Example — route AI decision

After an AI node returns { decision: "PASS" | "HOLD" | "CUSTOMER_ACTION" }:

Switch on:  lastOutput.decision

Case:  PASS              → Notify CSR for approval
Case:  CUSTOMER_ACTION   → Ask guest for missing docs
Case:  HOLD              → Escalate internally
Default:                 → Log unexpected value

Switch vs Condition

SwitchCondition
InputOne expression → one valueBoolean expressions per branch
BranchesCase values + DefaultIf / Else If / Else
Best forStatus / enum / fixed labelsRanges, compound checks (a && b)

Tips

  • Always keep a Default branch for unexpected values.
  • Match case strings exactly (case-sensitive) — "PASS""pass".
  • Put complex parsing in a Function or Transform node upstream, then switch on a clean field.
  • Check Execution Data after a run to see the evaluated switch value and which branch was taken.