Writing Conditional Expressions

Use conditional expressions to determine which action will happen next in your flow based on the criteria that must be met. For example, you can specify which queue a call will be placed in based on the digits the caller presses. You can enter conditional expressions in Resource Entry flow notations and connections from Decision Branches to other objects. There are a few ways to retrieve information to use in conditions such as the digits that a caller presses or the attributes that you assign in your flow.

Building a Conditional Expression

Conditions must be entered into flow elements in the domain specific language (DSL). When you create conditional expression in flows, ensure that you:

  • Surround the expression in parentheses
  • Surround strings or exact values (such as digits pressed) in quotation marks
  • Enter variables without quotation marks
  • Enter any variable names in the condition with the same spelling and case that you entered them in binding or name fields previously in the flow previously
  • Set boolean conditions to "TRUE" when writing conditions for decision branches for best results. Using "FALSE" may not always work as intended with reusable flow variables.
  • Refer to attributes that are defined using the Assign flow notation activity in the same portion of the flow where they are defined. For example, if the attribute is defined in the caller's portion of the flow, you cannot reference it in a condition in the agent's portion of the flow. If you want to use the attribute in the agent's portion of the flow, you must define it again in the agent's portion of the flow or with the Assign Global flow notation.
Symbol Meaning Example conditional expressions

=

Equal to

(= "1" digits)

The caller must press 1 when they call.

(= on-call "true")

The attribute that you named on-call is true.

or Or: Any of the values listed can be true

(or (= "1" digits)(="2" digits))

The caller must press either 1 or 2.

(or (= "English" language) (= "Spanish" language))

For the attribute that you named language, either English or Spanish must be true for the caller.

and

And: All of the values must be true

(and (= "English" language)(= "4" reason))

For an attribute that you named language, English must be true for the caller and the caller must have pressed "4" as the options for the Collect Digits activity named "reason".

not

 

Not: None of the values listed can be true

(not (= "1" digits))

The caller must not have pressed 1. For example, 2 would be valid.

(not (= "Gold" SupportLevel))

For the attribute that you named SupportLevel, Gold cannot be true for the caller.

contains?

Contains: The value listed in the condition must be present in the information collected. It can be at the beginning, middle, or the end.

The value on the left must contain the value

(contains? interaction/customer "555")

The customer's identifier (such as their phone number) must contain 555. For example, 15065551234 would be valid.

starts-with?

Starts with: The information collected must begin with the value that is listed in the condition.

In other words, the value on the left must begin with the value on the right.

(starts-with? interaction/customer "1506")

The customer's identifier, such as their phone number, must begin with 1506. For example, 15065551234 would be valid.

ends-with?

Ends with: The value collected must end with what is included in the condition.

In other words, the value on the left must end with the value on the right.

(ends-with? interaction/customer "companyabc.com")

The customer's identifier, such as their email address, must end with companyabc.com. For example, john@companyabc.com would be valid.

<

Less than: The information collected must be less than what is included in the condition.

In other words, the value on the right must be less than the value on the left.

(< 5 CSAT)

The value collected for the attribute called "CSAT" must be less than 5. For example, 3 is valid.

<=

Less than or equal to: The information collected must be less than or equal to what is included in the condition.

In other words, the value on the right must be less than or the same as the value on the left.

(<= 5 CSAT)

The value collected for the attribute called "CSAT" must be less than 5 or equal to 5. For example, 3 or 5 are valid.

>

Greater than: The information collected must be greater than what is included in the condition.

In other words, the value on the right must be greater than the value on the left.

(> 6 CSAT)

The value collected for the attribute called "CSAT" must be greater than 6. For example, 8 is valid.

>=

Greater than or equal to: The information collected must be greater than or equal to what is included in the condition.

In other words, the value on the right must be greater than or the same as the value on the left.

(>= 6 CSAT)

The value collected for the attribute called "CSAT" must be greater than or equal to 6. For example, 6 or 8 would be valid.

between?

Between: The information collected must be between the values in the condition. The values entered in the condition are inclusive.

(between? 1 5 CSAT)

The value collected for the attribute called "CSAT" must be between 1 and 5. For example, 1 or 3 would be valid.


You might also be interested in: