Routes the workflow to one of several named branches based on the value of an expression. Works like a switch/case statement โ each possible value gets its own path, with a default branch for anything that does not match.
switchWhen you need to send a workflow down more than two paths โ not just true or false โ the Switch node is the right tool. You define a single expression to evaluate (usually a variable from a previous step), then list the specific values you want to handle. Each value becomes a separate branch. Any value not listed is captured by the default branch.
This is useful whenever a piece of data can be one of a known set of values and each value requires different follow-on actions. Classic examples include order statuses, notification types, user roles, or response codes.
In graph mode, each case value creates a dedicated output port on the Switch node. Draw an edge from each port to the first node of the corresponding branch. The default port catches all unmatched values.
In linear mode, subsequent steps are tagged with a case label. Only steps whose label matches the evaluated case will execute. Steps tagged default run when no case matched.
| Field | Status | Description |
|---|---|---|
| Expression | Required | The value to test. Can be a static value or a variable reference, e.g. {{ order.output.status }}. The expression is evaluated and its result compared against each case. |
| Cases | Required | An array of case values. Each entry creates one named branch. A default branch is always present and catches anything that does not match a defined case. |
The Switch node exposes the following output variables in subsequent steps:
| Variable | Type | Description |
|---|---|---|
matched_case |
string | The case label that was matched, e.g. "approved". If nothing matched, the value is "default". |
expression_value |
mixed | The raw value that was evaluated โ useful for logging or downstream display. |
An e-commerce workflow receives an order object. Depending on the status field, it must send different emails, update different records, and call different downstream services.
pending, approved,
rejected, and keep the automatic default branch.
"Approved" does not match a case labelled approved.
Normalise your data upstream if needed (e.g. with a Set Variable node using a lowercase
transformation).