Inbound Action - Recipient Contains
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2025 06:20 AM
Hello,
Today we found an issue with one of our inbound action where it is set to activate if Recipient CONTAINS lis@OurOrganisation.com. This is how all of our inbound actions have always been set up and have worked without issue. However, today it got triggered because a user who's email address ended in lis@OurOrganisation.com (e.g. John.Salis@OurOrganisation.com) was in the recipients list.
Is there a smarter way of configuring this? I can't just put 'Recipient IS lis@OurOrganisation.com' because sometimes it will include multiple individuals in the Recipient field, and the same goes for the 'To' field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2025 06:24 AM
you can use script in that inbound action
// Get the recipients from the email
var recipients = email.recipients.split(',');
// Define the specific email address to check
var specificEmail = 'lis@OurOrganisation.com';
// Flag to determine if the specific email is found
var emailFound = false;
// Loop through each recipient and check for an exact match
for (var i = 0; i < recipients.length; i++) {
var recipient = recipients[i].trim();
if (recipient.toLowerCase() === specificEmail.toLowerCase()) {
emailFound = true;
break;
}
}
// If the specific email is found, proceed with the inbound action
if (emailFound) {
// Your inbound action logic here
gs.info('Specific email found, proceeding with inbound action.');
} else {
gs.info('Specific email not found, skipping inbound action.');
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2025 12:52 AM
There are 2 emails it needs to identify in the 'specificEmail', how do I add an 'or'?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2025 12:59 AM
enhance as this
I believe I have answered your original question.
// Get the recipients from the email
var recipients = email.recipients.split(',');
// Define the specific email address to check
var specificEmail = 'lis@OurOrganisation.com';
var specificEmail1 = 'lis1@OurOrganisation.com';
// Flag to determine if the specific email is found
var emailFound = false;
// Loop through each recipient and check for an exact match
for (var i = 0; i < recipients.length; i++) {
var recipient = recipients[i].trim();
if (recipient.toLowerCase() === specificEmail.toLowerCase() || recipient.toLowerCase() === specificEmail1.toLowerCase()) {
emailFound = true;
break;
}
}
// If the specific email is found, proceed with the inbound action
if (emailFound) {
// Your inbound action logic here
gs.info('Specific email found, proceeding with inbound action.');
} else {
gs.info('Specific email not found, skipping inbound action.');
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2025 12:58 AM
Thank you for marking my response as helpful.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader