Page tree

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 Operators
Equals
Not Equals
Less Than
Greater Than
Less Than or Equals
Greater Than or Equals
Conditional Operator
Logical Operators
and
or
not
Arithmetic Operators
Plus
Minus
Multiply
Divide
Increment
Decrement
Modulus
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. E.g 2007, 2011, etc.
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. E.g Sunday, Monday, etc.
HourCurrent ET Hour of the day replaced at runtime in 24hrs 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

String functions (not separated, intentional?)

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 Value
Rounded Up Value
Rounded Down Value
Rounded Value
Random Value

Contact Fields and Ticket Fields