Inbound action - subject contains 'incident' && email address contains

RichardSaunders
Tera Guru

I'm struggling to get an inbound action working with the condition below.

The subject must always contain incident but must match one of the email addreses.

The inbound action still triggers if it contains 'incident' but is NOT one of the email addresess. 

if(email.subject.contains("incident") && email.to.toLowerCase().indexOf('systemsupport1@test.com') > -1 ||
 email.to.toLowerCase().indexOf('systemsupport2.@test.com') > -1 ||
 email.to.toLowerCase().indexOf('systemsupport3@test.com') > -1 ||
 email.to.toLowerCase().indexOf('systemsupport4123@test.com') > -1 ||
 email.to.toLowerCase().indexOf('systemsupport5@test.com') > -1 || 
 email.to.toLowerCase().indexOf('systemsupport6@test.com') > -1) {

 

 

4 REPLIES 4

Jaspal Singh
Mega Patron
Mega Patron

 Try below

if((email.subject.indexOf("incident")>-1) && (email.to.toLowerCase().indexOf('systemsupport1@test.com') > -1 ||
 email.to.toLowerCase().indexOf('systemsupport2.@test.com') > -1 ||
 email.to.toLowerCase().indexOf('systemsupport3@test.com') > -1 ||
 email.to.toLowerCase().indexOf('systemsupport4123@test.com') > -1 ||
 email.to.toLowerCase().indexOf('systemsupport5@test.com') > -1 || 
 email.to.toLowerCase().indexOf('systemsupport6@test.com') > -1)) {

Thanks, but it still triggers from an email not on the list.

RichardSaunders
Tera Guru

Any ideas?

 

RichardSaunders
Tera Guru

Bump!