ServiceNow outbound emails to populate recipient in BCC field and not the TO field for all notificat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2023 11:19 PM
Reconfigure ServiceNow outbound emails to populate recipient in BCC field and not the TO field.
This way, when people receive a ServiceNow email and do a reply all... they will only be replying to the ServiceNow mailbox...
We need to create a script that will trigger BEFORE an email is sent,
and interrogate the TO field for any recipients starting with “SNOW-“ and move that recipient from the TO field to the BCC field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-21-2023 06:28 AM
HI @Deepa Dhandapan ,
I trust you are doing great.
Here's an outline of the solution:
- Log in to ServiceNow as an administrator.
- Navigate to "System Definition" -> "Business Rules" and click on "New".
- Provide a suitable name for the Business Rule, such as "Move SNOW Recipients to BCC".
- Set the "Table" field to "sys_email".
- In the "When to run" section, select the "Before" option and choose "Insert" and "Update" from the list.
- In the "Advanced" section, add the following script:
(function executeRule(current, previous /*, ...*/ ) {
var recipients = current.recipients.split(',');
var bccRecipients = [];
var updatedRecipients = [];
for (var i = 0; i < recipients.length; i++) {
var recipient = recipients[i].trim();
if (recipient.toLowerCase().startsWith('snow-')) {
bccRecipients.push(recipient);
} else {
updatedRecipients.push(recipient);
}
}
current.recipients = updatedRecipients.join(',');
current.bcc = bccRecipients.join(',');
})(current, previous /*, ...*/ );
- Click on "Submit" to save the Business Rule.
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-21-2023 10:56 AM