How to use variables and constants

How to use variables

Caution

A variable must be either a built-in system variable or a user-defined variable previously created using the Assign block. If you specify a variable that does not exist, the variable is ignored and evaluates to an empty string in the results.

Variables may be used, instead of or in conjunction with literal strings, in all properties of the CCaaS Designer blocks. To indicate a variable name, enclose the name within dollar signs ($). For example, if you have a variable called GreetingFName that holds the name of the greeting announcement, you could use it by setting the Play Audio block's Value property to:

$GreetingFName$

You can use literals and variables together in the same CCaaS Designer property. The interpreter expands all of the variables specified and concatenates them together with the literals before executing the block. For example, if you have two variables called FName and LName that hold the first and last names of the caller and you want to use them in the Subject property of the Send Email block, set the Subject property to:

Voicemail call from $FName$ $LName$

Any embedded spaces or quotes (") are included in the resulting string. So, in the above example, if FName contained the string "John" and LName contained the string "Doe", the resulting string is "Voicemail call from John Doe".

To include a literal dollar sign ($) in a string, precede the dollar sign with another dollar sign. For example, if you want to assign a variable a string that contains a dollar sign and you have a variable called Cost that contains the string "4.00", specify it like this:

The cost for that is $$$Cost

The resulting string is "The cost for that is $4.00".

Note

Be careful when using variables in the Expression property of the Condition block. The way that the interpreter expands variables into an intermediate string before using them can cause the interpreter to incorrectly evaluate an expression. This is the only property in CCaaS Designer in which you must use quotes (") to denote a string. Furthermore, if a variable is to be evaluated as a string, enclose the variable in quotes.

Examples

If you have a variable called CallerEntry and you want to check if it is equal to the number 1234, the expression property is:

$CallerEntry$ = 1234

The resulting string is '1234 = 1234'.

If you have the same situation as above, but you want to check if CallerEntry is equal to the string "1234", then the expression property is:

"$CallerEntry$" = "1234"

The resulting string is '"1234" = "1234"'. Both the variable and the literal 1234 are enclosed in quotes. Using quotes forces both sides of the equation to be the same data type, which is string.

If you have two variables called FName and LName and you wanted to check to see if the caller's name is equal string "John Doe", the expression is:

"$FName$ $LName$" = "John Doe"

The resulting string is '"John Doe" = "John Doe"'. The entire left-hand side of the expression is enclosed in quotes, not each variable. If you specified the expression as, "$FName$" "$LName$" = "John Doe", the resulting string would be '"John" "Doe" = "John Doe"' and an error would occur in the evaluation of that expression.

How to use the $empty$ constant

For the CallPreSent script, you can use the $empty$ constant in the Edit Email block to set a property to empty.

For example, in the Edit Email block, if you put $empty$ in the CC field, any value previously there is removed and it is set to an empty value.