The Zurich release has arrived! Interested in new features and functionalities? Click here for more

syntax for indexOf() does not contain

SNowUser11
Kilo Guru

Hi,

what is the syntax for if I want to check if the string DOES NOT CONTAIN in indexOf(). I am writting inbound actions so want to trigger only if it does not contain certain string.

Thanks

1 ACCEPTED SOLUTION

Mike Patel
Tera Sage

I did something like below to ignore a inbound action based on who is it from

email.from.toLowerCase().indexOf('XXXX@gmail.com') == -1 

so on inbound action on condition field add something like that make sure to change field.

if you want to check subject line than use like

email.subject.toLowerCase().indexOf('XXXX') == -1 

View solution in original post

3 REPLIES 3

Mike Patel
Tera Sage

I did something like below to ignore a inbound action based on who is it from

email.from.toLowerCase().indexOf('XXXX@gmail.com') == -1 

so on inbound action on condition field add something like that make sure to change field.

if you want to check subject line than use like

email.subject.toLowerCase().indexOf('XXXX') == -1 

Onkar Pandav
Tera Guru

Hi,

indexOf() method in javascript returns -1 if the string does not contain the string we are looking for otherwise the offset(which is greater than -1).

Syntax:

string.indexOf("lookup String");  // if -1 then not present, otherwise present

Check: JavaScript indexOf() method

asifnoor
Kilo Patron

Hi,

If you want to check for subject, check like this

email.subject.indexOf("your_string")==-1