Inbound Email Action - Based on Recipient

k_ab
Kilo Contributor

Hi All,

We have a mailbox setup that will automatically forward emails to our SN instance. Based on where the email is coming from, I'm trying to have incident tickets created with pre-populated fields. I'm having trouble with the script - as it's not recognizing the recipient and setting the INC fields accordingly.

Looking at the email log, I can see that 'feedback@mycompany.com' is showing in the "Recipients' field.

find_real_file.png

 

This is the snippet in question:

If (email.recipients.toLowerCase().indexOf('feedback@mycompany.com') > -1)  {
   current.assignment_group.setDisplayValue("Group 1");
}
else {
  current.assignment_group.setDisplayValue("Group 2");
}

 

TIA!

Keith

 

6 REPLIES 6

k_ab
Kilo Contributor

Thanks Mike. Appreciate the help.

This ultimately ended up being the solution: 

if (email.direct.toLowerCase().indexOf('email@domain.com')>-1) 
  current.assignment_group.setDisplayValue('Group 1');

ref:link

 

 

Yep, using quotes will get you sometimes. I see a lot of people using them a lot instead of ' '.

Glad you got it sorted out!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!