Add a Switch Action

You add a Switch action when you want to evaluate an expression and create an outcome with that value. An outcome of "default" is invoked when the expression does not evaluate to a usable string.

To use a Switch action:
  1. Add the action in one of three ways, depending on your preference and where you want it added:
    • Drag the action from the Actions palette onto the canvas, dropping the action either at the bottom edge of the action it is to follow, or at the top edge of the action it is to precede.
    • Double-click the action in the Actions palette to add it to an empty canvas or to the end of an action chain.
    • On the canvas, select the action you want the new action to follow, then double-click the new action in the Actions palette.
  2. For the Value property, select the variable that is to be compared against each case value. If the variable's value doesn't match a case value, or it's null or undefined, the default case is executed.

    For example, when a menu defines a set of options, you can use the Switch action to perform actions for each menu item. In this case, you'd select the menuId input parameter for the Value property:
    Description of jsac-switch-action.jpg follows
    Description of the illustration jsac-switch-action.jpg

  3. For each case, to select the case in the Properties pane, click it in the Switch action, then select the value for the case using the Value property. Next, drop the actions to execute for the case in the Drop actions here area of the case block and configure their properties in the Properties pane.