Inbound Email Action - Based on Recipient
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2018 03:48 PM
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.
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2018 08:29 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2018 08:38 AM
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!