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.
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:
|
Expression |
If you choose Take path of first case that matches the below expression, enter the desired expression here. |
Cases (Boolean) |
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:
|
Add Case |
Click next to Cases (Boolean) 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. |