- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2025 06:25 PM
Hello!
Still learning the ins and outs of ServiceNow and the the different things that can be done with email notifications. I have an existing email notification that needs its conditions to be updated. Right now, in the 'Who will receive' tab, there is Groups SNOW Dev and SNOW Test. What's being asked, where I'm not sure how to go about, is the email notification should be dynamically set based on the environment you are in. Would anyone be able to guide a relatively new ServiceNow user on how to do this? Thank you for the time!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2025 07:54 PM
how are you triggering the email? using event or directly using the notification "Inserted" and "Updated" checkboxes?
To handle dynamic recipient you should use after business rule & create event on the same table as that of the notification
Then based on your logic you can set the recipients via triggering the event.
I hope I have answered your question and you can enhance it further based on your requirement.
1) create event on your table
2) make notification trigger on that event, ensure "Event parm1 contains recipient" is checked
3) use business rule to trigger the event
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var recipient = '';
var instanceName = gs.getProperty('instance_name');
if (instanceName == 'dev instance')
recipient = 'groupSysIdForDev';
else if (instanceName == 'test instance')
recipient = 'groupSysIdForTest';
gs.eventQueue('event_name', current, recipient);
})(current, previous);
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-15-2025 06:48 AM
I already shared a working approach below.
Did you get a chance to check?
It should work for you and you can enhance it as per your case.
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-14-2025 07:54 PM
how are you triggering the email? using event or directly using the notification "Inserted" and "Updated" checkboxes?
To handle dynamic recipient you should use after business rule & create event on the same table as that of the notification
Then based on your logic you can set the recipients via triggering the event.
I hope I have answered your question and you can enhance it further based on your requirement.
1) create event on your table
2) make notification trigger on that event, ensure "Event parm1 contains recipient" is checked
3) use business rule to trigger the event
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
var recipient = '';
var instanceName = gs.getProperty('instance_name');
if (instanceName == 'dev instance')
recipient = 'groupSysIdForDev';
else if (instanceName == 'test instance')
recipient = 'groupSysIdForTest';
gs.eventQueue('event_name', current, recipient);
})(current, previous);
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-15-2025 07:26 PM
Hope you are doing good.
Did my reply answer your question?
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-16-2025 05:08 AM
Apologies for the delayed response, thank you for the time you took to help me! I have not yet tried it, but I understand the logic. Trying today, and hoping it works. Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2025 05:20 AM
Glad to help.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader