- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2025 09:21 PM
Hello Guys,
I have a requirement where, if an approval is rejected for a specific catalog item, I need to include some additional details in the "Closed Complete" notification that is sent from the Request table. However, this notification is global and used for all catalog items. I want to update it only for this particular catalog item without impacting any others. Can someone help me achieve this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2025 11:28 PM
if your notification is on sc_request then script I shared is correct but you added these lines again
so just keep this below code within the email script
var rec = new GlideRecord('sc_req_item');
rec.addQuery('request', current.sys_id);
rec.addQuery('cat_item.name', 'Your Item Name');
rec.query();
if (rec.hasNext()) {
template.print('your content here');
}
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 09:36 PM
then separate it out
1) update the OOTB email notification so that it doesn't trigger for that specific catalog item, use the advanced notification condition and use script to check this
var rec = new GlideRecord('sc_req_item');
rec.addQuery('sys_id', current.sysapproval);
rec.addQuery('cat_item.name', 'Your Item Name');
rec.query();
answer = !rec.hasNext(); // don't trigger OOTB if it's your item
2) create a new notification on sysapproval_approver which triggers only for your specific catalog item, use script in advanced notification condition script
var rec = new GlideRecord('sc_req_item');
rec.addQuery('sys_id', current.sysapproval);
rec.addQuery('cat_item.name', 'Your Item Name');
rec.query();
answer = rec.hasNext(); // trigger for your item only
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 09:40 PM
Hello @Ankur Bawiskar
My requirement is to trigger the standard out-of-the-box "Closed Complete" email notification as it normally works. However, for one specific catalog item, I need to append some additional notes at the bottom of the email—without impacting how the notification behaves for other catalog items.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2025 09:51 PM - edited 04-14-2025 10:06 PM
then create a email script and add that in the OOTB email notification body
in the email script check close completion is for which catalog item and then only include the email content
Something like this in email script
(function runMailScript(current, template, email, email_action, event) {
// Add your code here
var rec = new GlideRecord('sc_req_item');
rec.addQuery('request', current.sys_id);
rec.addQuery('cat_item.name', 'Your Item Name');
rec.query();
if (rec.hasNext()) {
template.print('your content here');
}
})(current, template, email, email_action, event);
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 10:07 PM
Still I'm not able to find any message Contents in the OOTB Email Body.