Filter Contact History by Keyname: Pattern and Regular Expressions | Vantage CX - 1.4 - Filter Contact History by Keyname: Pattern and Regular Expressions - Vantage Customer Experience

Vantage Customer Experience User Guide

prodname
Vantage Customer Experience
vrm_release
1.4
created_date
June 2021
category
User Guide
featnum
B035-3800-099K

Patterns and regular expressions can also be used to filter Contact History data by Keyname. Use the pattern expression function in conjunction with the contactHistory function.

For example, let say 'foo' is the text to search:

Keyname is case-sensitive when used in expressions.

pattern

pattern("foo.*")          // starts with
pattern("^(?!foo).*")     // not starts with
pattern(".*foo")          // ends with
pattern("^(?!.*foo$).*")  // not ends with
pattern(".*foo.*")        // contains
pattern("^((?!foo).)*")   // not contains

Example 1

Criteria:
-Qualify if: 
-A Message has been extended or responded in Channel with Keyname that starts with 'sms'
 
Expression:
set("extendedOrResponded", contactHistory("channel", pattern("sms.*"))) &&
count(extendedOrResponded) > 0

Example 2

Criteria:
-Qualify if: 
-A Message has been extended or responded to the customer
-In any Channel
-For Message Strategy with Keyname that contains the text 'recharge'
 
Expression:
set("extendedOrResponded", contactHistory("messageStrategy", pattern(".*recharge.*"))) &&
count(extendedOrResponded) > 0
In this case, Message Strategy 'Recharge' Keyname, which is 'recharge', is used to filter Contact History data. This is similar to running the following SQL query:
select * from contact_history_table where message_strategy_keyname = 'recharge'

No other conditions are needed in the expressions. The resulting List is evaluated by the count function.