The Contact Flow Engine allows you to build expressions (conditions) using the available functions, system and custom variables, logical operators, and other primitives using the Expression Builder. You can use these expressions in modules (like the condition or variable_assignment modules) that require you to compare user inputs with specific conditions and create decision points in your contact flow, 

Here are a few sample expressions that the Expression Builder enables:

Expression

Description

getDay()='Saturday'|getDay()='Sunday'

Checks to see whether today is a weekend (either a Saturday or Sunday).

custom_counter<=3

Checks to see whether the current value of a custom counter (maintained in a contact flow variable called custom_counter here) is less than or equal to 3.

This could be used to loop through some part of the contact flow no more than 3 times.

PHONE DIALED.substr(0,3)='415'

Checks whether the area code of the system variable PHONE DIALED is 415.

.10*TOTAL AMOUNT<=500&cc_type='visa'

Checks whether the client's minimum payment amount (10% of the total amount owed by the consumer, which is maintained in the system variable TOTAL AMOUNT) is less than or equal to 500 dollars, AND the credit card being used by the client is a VISA.

(Here, cc_type is a contact flow variable.)

Tips to add an Expression

  • Use the controls provided below the 'Expression' field and click 'Add to Expression' to update an expression.
  • The 'Data Type' drop-down provides a list of possible items you can select from to add to the expression, such as 'System Variables', 'Contact Flow Variables', 'Functions', and 'Mathematical Operators. Based on the selection here, the 'Selection' drop-down list is updated to display the relevant list of options you can select from.
  • The 'Value' drop-down control provides a list of all available variables - system and call flow. You can also type in a literal for the value.
  • Clicking the AND or OR button simply adds that logical operator to the expression in the 'Expression' field, at the current cursor position.
  • When you click the 'Add' button, the expression you've built with the four controls (Data Type, Selection, Operator, Value) is added to the expression in the 'Expression' field. To support more complex expressions involving AND or OR, note where you place the cursor to ensure the expression is appended, so that you do not overwrite an existing value in the 'Expression' field.
  • When adding multiple entries in an expression, separate your expressions with a pipe delimiter. For example:
  • (new Date().getMonth() +1).toString() + \'/\' + new Date().getDate().toString() == \'12/24\' |
  • (new Date().getMonth() +1).toString() + \'/\' + new Date().getDate().toString() == \'12/25\'

Components of the Expression Builder

Boolean OperatorsDescription
EqualsChecks whether two values are exactly the same.
Not EqualsChecks whether two values are different.
Less ThanCompares two values and checks if the first is smaller than the second.
Greater ThanCompares two values and checks if the first is larger than the second.
Less Than or EqualsChecks if a value is either less than or equal to another value.
Greater Than or EqualsChecks if a value is either greater than or equal to another value.
Conditional OperatorA logical operator used to evaluate conditions and determine which values meet specific criteria.
Logical OperatorsDescription
andCombines terms.
orProvides an alternative.
notExcludes the specified term.
FunctionsDescription
TodayCurrent ET Date replaced at runtime with date in the format MM/DD/YYYY.
TimeCurrent ET Time of day replaced at runtime with time in the format 'HH:MM:SS'.
YearCurrent ET Year replaced at runtime with day. For example, 2007, 2011.
MonthCurrent ET Month of the Year replaced at runtime in the range of 1-12.
DateCurrent ET Day of the month replaced at runtime in the range of 1-31.
DayCurrent ET Day of the week replaced at runtime with day. For example, Sunday, Monday.
HourCurrent ET Hour of the day replaced at runtime in 24 hours format.
MinutesCurrent ET Minutes of the Hour replaced at runtime.
Epoch MillisecondsCurrent ET Epoch Time replaced at runtime with no of milliseconds from Jan 1, 1970.
Timezone Offset MinutesTime difference between UTC time and Current ET time, in minutes.
SubstringExtracts the characters from a string, beginning at a specified start position, and through the specified number of character.
Lower CaseConverts a string to lowercase letters.
Upper CaseConverts a string to uppercase letters.
Absolute ValueReturns the absolute value of x.
Rounded Up ValueReturns x, rounded upwards to the nearest integer.
Rounded Down ValueReturns x, rounded downwards to the nearest integer.
Rounded ValueRounds x to the nearest integer.
Random ValueReturns a random number between 0 and 1.