Appearance
Switch node
The Switch node routes a flow by matching a value against a list of cases. Each case maps a value to a named output port; anything that doesn't match falls through to the default port. Use it when an If node's two-way branch isn't enough.
Component id: flowrunner/switch.
How it works
Switch reads a source, converts it to a string, and compares it against each case's value (also compared as a string). The first case whose value matches sends the flow out that case's port. If no case matches, the flow leaves on default.
The source is resolved two ways:
- If it's a dotted reference (
variable.field) whose namespace exists in refs, Switch reads that value from the flow's refs — supporting nested paths likeresponse.body.status. - Otherwise the source is treated as a literal string, with
${env.X}and${secrets.X}resolved first.
Comparison is string-based: the source value and each case value are both coerced to strings (objects are JSON-serialised) before matching. So a numeric 200 matches the case value "200".
Config
| Field | Required | Description |
|---|---|---|
source | Yes | The value to switch on — a dotted reference (start.plan, response.status) or a literal. |
cases | Yes | An array of { value, port } objects. value is the value to match; port is the output port to follow on a match. A case with a blank port is skipped. |
The three-case fixed-port editor
In the visual editor, Switch presents a fixed set of case rows — three by default — each pairing a value you type with an output port. This keeps the node's shape stable on the canvas: you wire each port to a branch once, then change the values without re-drawing connections. Cases with no value simply never match and fall through to default.
INFO
📸 Screenshot — the Switch inspector showing the three case-value rows plus the default port
Ports
| Port | Followed when |
|---|---|
| (your case ports) | The source equals that case's value. |
default | No case matched. |
Wire every case port you use, plus default, so no matched value dead-ends.
Example
text
Switch source: response.status
cases:
"200" → success branch
"404" → not-found branch
"500" → server-error branch
default → fallback branchNOTE
Because matching is string-based, make sure case values are written as strings. To branch on a request field, point source at a reference like start.plan; to branch on a fixed environment value, use a literal with ${env.STAGE}.