Switch action


A switch action branches on condition after evaluating one or more expression cases. This action is similar to a Decision action, and is easy to set up when multiple cases must be evaluated. Configure a switch action to specify what has to be done by Architect, when, and under which circumstances. For more information about the Switch action, click to expand the following sections.

Switch actions are simple in Architect because of the easy to view case labels in the task editor. Each value is a case, and the associated variable is run, or switched on, after being checked for in each case. When the variable being switched on is equal to a case, Architect executes the statements following that case.

For example, let’s assume you want to play specific audio to a caller based on account status. If the account is paid to date, you want the caller to hear about upcoming promotional specials. If the account is past-due, you want to provide the caller with a list of available payment methods. If the account is delinquent, you want to let the caller know that he or she will be transferred to the appropriate department. If the caller doesn’t have an account, you want the caller to hear a default audio prompt. The Switch action helps you lay out these options in the call flow’s visual task editor.

You can have up to 64 cases within a switch, including a default case that appears at the end of the switch. The default case can be used for performing a task when none of the previous cases is true. You can also branch in another switch action as a case statement.


By default, the Switch action presents Boolean expression configuration. However, when you select the expression type, you can use any expression as long as the expression type matches the case statement. When you create a Switch action using an expression as the evaluation style, consider the following:

  • Expression types must match cases types. A Boolean expression must have Boolean cases, a String expression must have String cases, and so on.
  • If the expression type for the expression to be evaluated changes, a Change cases to button appears. Depending on the type of expression, this button label varies. 
  • For cases in Literal mode, when you click the Change cases to button Architect resets all previously entered values. Use caution before clicking this button. Values entered in Expression mode remain intact unless you switch to Literal mode.
  • When you click the Change case to button, the Case value boxes change to accept entries for the selected expression variable.


Name Description
Name  Type a descriptive name for the Switch action.

Evaluation Style

Choose one of the following:

  • Take path of first case that returns True. The first time that a condition returns a value of True, Architect follows that path and does not move to any further cases.
  • Take path of first case that matches the below expressionThe first time that a condition equals a specified expression, Architect follows that path and does not move to any further cases.

Expression

If you choose Take path of first case that matches the below expression, enter the desired expression here.

Cases

Define the Boolean expression in the Case configuration boxes. By default, these boxes are in literal mode. Switch between literal and expression modes to enter more detailed expressions, or to access the large expression editor and Operator and Function help.

You can also:

  • Click X to remove a case.
  • Use the up and down arrows to move cases to different locations in the action.

Add Case

Click to add additional cases. The minimum number of allowable cases is 1 (in addition to the default), and the maximum number of allowable cases is 64.

Default Case

This is the default path that the flow will take if the added cases do not apply.
Note: After you define the evaluation style and switch cases in the Switch action’s design area, make sure you add the desired actions below each case in the task editor.