A selection statement that outputs on a certain output based off condition for a case. Can also act as a router, which outputs on any case that evaluates true simultaneously.


With this Node, you can create one or more cases. Each case contains one or more conditions. For every case that is made, an output is generated on the Switch Node. You must set the name of this output next to the Output field for each case.

Each case can have multiple conditions separated by AND or OR clauses. Checking the Evaluates Inverse checkbox will cause the condition evaluation to be inverted.

All Nodes that use conditional expressions in Sanbox use implicit primitive conversions. For example, if you pass a number and then a string into a Text Matches operation, then the number is converted to a string for the sake of the condition check.

Sanbox does logical comparison rather than bitwise.

Configuring a Switch Node

The Switch Node has two modes, switch and router.

Switch Mode

In switch mode, the first case that evaluates to true is outputted. If no case evaluates to true, the default output is fired.

Router Mode

In router mode, each case that evaluates to true will be outputted at the same time creating multiple execution paths. If no case evaluates to true, the default output is fired.


Consider the following Workflow:

We have an API Request Node configured for endpoint switchTest/{phrase} and a Switch Node configured as the first picture above. In this Workflow, we simply return an object containing a message in response to what the user places in the phrase parameter.

Our Workflow will behave as follows:

  • If the phrase is 'hello', then we will return a response with 'Hello from Sanbox!'

  • If the phrase is 'goodbye', then we will return a response with 'See you later!'

  • If the phrase is neither 'hello' or 'goodbye' then we will return a response with 'Sorry didn't get that.'

Our Switch Node outputs to our Gather Nodes, which output the correct response message as a string. We use the Builder Node to create a simple JSON object with a message property containing this string. Finally, we return the response with the API Response Node for this API call.

Testing our Workflow with the phrase 'goodbye' with the debugger running shows us the execution path taken.

And here is the object our API returns:

"message": "See you later!"