maestro
latest
false
Maestro Orchestrate user guide
- Introduction
- Getting started
- Build on any canvas
- Build with Case
- Reference
- Defining case keys (system vs. external)
- Establishing task I/O and write-back contracts
- Modeling primary and secondary stages
- Triggering a case from Data Fabric
- Implementing stage-level personas and permissions
- Setting SLAs and automated escalation rules
- Configuring a rework loop (re-entry)
- Configuring and testing the Case Manager Agent (preview)
- Build with Flow
- Build with BPMN
- Operating
- Monitoring
- Optimizing
- Reference information
Switch
The Switch node routes a workflow to one of several paths based on ordered case conditions.
What it does
Routes a workflow to one of several paths based on ordered conditions. By default, the first condition that matches is taken. With Match all cases turned on, every case whose condition is true runs its branch.
Choosing between Switch and Decision
| Use Switch when... | Use Decision when... |
|---|---|
| You have three or more outcomes | You have exactly two outcomes |
| You're routing by multiple distinct conditions | The condition is a simple yes/no |
| You need a default/fallback branch |
Configuration reference
| Field | Required | Default | Description |
|---|---|---|---|
| Switch cases | Yes | 2 empty cases | Ordered branch list, up to 10 cases. Each case has a label and a Condition, a JavaScript expression that returns true or false. The first case whose condition is true is taken. |
| Default branch | No | On | Adds a Default path that runs when no other condition matches. |
| Match all cases | No | Off | When on, the flow continues down every case whose condition is true, not only the first. To continue after the matched branches, connect them to a Merge node, which waits only for the branches that ran. |
Writing case expressions
Each case expression uses the same JavaScript environment as the Script and Decision nodes:
// Case 1: high priority
$vars.ticket1.output.priority === "high"
// Case 2: medium priority
$vars.ticket1.output.priority === "medium"
// Case 3: low priority (or use Default to catch everything else)
$vars.ticket1.output.priority === "low"
// Case 1: high priority
$vars.ticket1.output.priority === "high"
// Case 2: medium priority
$vars.ticket1.output.priority === "medium"
// Case 3: low priority (or use Default to catch everything else)
$vars.ticket1.output.priority === "low"
More specific conditions should appear first. A broader condition higher in the list will match before a more specific one below it. With Match all cases turned on, the order doesn't decide which branch runs, because every matching case runs.
Examples
Example 1: Route by HTTP status code
| Case | Expression | Branch |
|---|---|---|
| Success | $vars.httpRequest1.output.code === 200 | process the response |
| Not Found | $vars.httpRequest1.output.code === 404 | handle the missing resource |
| Default | (fallback) | handle the unexpected error |
Example 2: Route by string value
| Case | Expression | Branch |
|---|---|---|
| Approved | $vars.form1.output.status === "approved" | continue the workflow |
| Rejected | $vars.form1.output.status === "rejected" | notify the rejection |
| Pending | $vars.form1.output.status === "pending" | wait for review |
| Default | (fallback) | handle the unknown status |
Next steps
- Decision node: branching into exactly two paths.
- Variables and data flow:
$varssyntax and expression patterns. - Error handling: handling failures, which differs from conditional branching.