Inbound action - proper syntax for indexof

scottatah
Giga Expert

Hi Everyone,

 

We've got a buncha of inbound rules to turn emails into New Call records from our various support mailboxes.   For one particular mailbox, they'd like to exclude emails from non @abc.com domains from being created into tickets.   I thought I had it right, but it's not working and I dunno what I'm doing wrong or why.

 

email.to.toLowerCase().indexOf('facilities@abc.com') > -1

&&

email.from.toLowerCase().indexOf('@abc.com') > -1

 

 

My understanding is that, that should process when the email is sent to facilities@abc.com AND the email is from @abc.com.   Clearly thats not the case or at least not happening.


Also, for the email.to.toLowerCase().indexOf, does that cover whether the facilities@abc.com is on the TO or the CC line?

1 ACCEPTED SOLUTION

Ugh, I had the wiki opened to that page - not sure why I didn't just look that up.   But you make great points all around.   In relation to the initial problem, the syntax was right, turns out it I was just using the wrong email address - DOH!   should have been facility not facilities.


View solution in original post

2 REPLIES 2

williamsun
Mega Guru

According to this, the email.to object has both TO and CC:


http://wiki.servicenow.com/index.php?title=Inbound_Email_Actions#Accessing_Email_Objects_with_Variab...


You could also use email.recipients instead.



On the same note, you might want to use email.origemail instead of email.from as there are conditions under which the email.from might not have what you are looking for.


Ugh, I had the wiki opened to that page - not sure why I didn't just look that up.   But you make great points all around.   In relation to the initial problem, the syntax was right, turns out it I was just using the wrong email address - DOH!   should have been facility not facilities.