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

Mike Patel
Tera Sage

try 

if (email.from.toLowerCase().indexOf('feedback@mycompany.com') != -1)  {
   current.assignment_group.setDisplayValue("Group 1");
}
else {
  current.assignment_group.setDisplayValue("Group 2");
}

k_ab
Kilo Contributor

Thanks Mike; doesn't want to work - I also couldn't find any documentation for 'email.from'.

try below. I have inbound action that uses email.from and works fine for me.

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

also try setting group using sysid something like

current.assignment_group = 'sysid';