- 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 10:29 PM
share your script and screenshots.
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 11:14 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2025 11:18 PM - edited 04-14-2025 11:19 PM
Hi @dmahendran ,
Your notification is on the Requested Item table, not on the Approval table, correct?
If so then please check my response.
Regards,
Robert
- 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:54 PM - edited 04-14-2025 09:55 PM
Hello @dmahendran ,
Please create a new Email Script that adds the additional details for the special Catalog Item, for example:
Name: more_info_for_special_cat_item
Script:
(function runMailScript( current, template, email, email_action, event) {
var specialCatItem = 'e1be6dcb4f7b4200086eeed18110c74c';
if (current.getValue('cat_item') == specialCatItem) {
// additional details go here, for example:
template.print(current.getValue('due_date'));
}
})(current, template, email, email_action, event);
Then add a reference to this script in the Message text of your Notification, at the position where the additional details shall appear:
other content
...
${mail_script:more_info_for_special_cat_item}
...
other content
Regards,
Robert