Assign Block Common
Use the Assign common block to assign a computed value/expression or an entered value to a variable.
See the Query Services block Service Data property for an example of using the Assign block and Expression Builder to parse a JSON string and assign the service data to a variable.
Note: Function getSIPHeaderValue(headername) returns the SIP header value associated with the given SIP headername. You may wish to use this function with the Assign block.
The Assign block has the following properties:
Block Notes Property
Assign Data Property
To select a variable and assign a value:
- Click the Assign Data row in the block's property table.
- Click the button to open the Assign Data to Variables dialog box.
- Click in the Variable field to display a down arrow.
- Click the down arrow and select a variable whose value will be evaluated to determine the branching condition. Default application variables are described in the Property Entry block for voice applications and the Property Entry block for routing applications. You can also use a custom variable.
- Click under Expression to display the button.
- Click the button to open Expression Builder. For examples of how to use Expression Builder, see the Expression Builder topic.
- Select an operator for the branching condition.Your variable's value will be equal to (==), less than (<), greater than (>). less than or equal to (<=), greater than or equal to (>=) or not equal to (!=) to value you enter in the Expression field.
- In the Expression field, create a value to compare to the variable's value. Enclose the value in single quotes (' ').
- Click the button to validate the expression. Syntax messages appear under the Expression Builder title.
- Click OK to close Expression Builder and return to the Assign Data to Variables dialog box.
- You can make multiple variable/value assignments. Click the Add button if you wish to add more assignments and repeat the steps above.
To edit an expression:
- Click its row under Expression in the Assign Data to Variables dialog box. This causes the button to appear.
- Click the button to re-open Expression Builder where you can edit the expression.
- For callflows, invalid ECMAScript expressions may raise the following exception event: error.semantic.
- For workflows, invalid ECMAScript expressions may raise the following exception events: error.script.SyntaxError, and error.script.ReferenceError.
You can use custom events to define the ECMAScript exception event handling.