Notification section is only displayed if the approval is related to a RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
I have a notification running on sysapproval_approver table. I want to display a section in the email onöy when the approval is related to a RITM.
Fields I want to show in the notification:
Item (cat_item on RITM)
Requested For (requested_for on RITM)
and I also want to show the Variables Section of the RITM.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi @Emine,
for displaying the variables you might need the notification email script to be written as teh variables are stored in different table then the [sysapproval_approver].
Please share what you created to review it
100 % GlideFather experience and 0 % generative AI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
58m ago
@Emine To display a specific section in an approval email only when it relates to a Request Item (RITM) and include RITM details and variables, you should use an Email Script. This approach allows you to check if the sysapproval field points to an sc_req_item table and retrieve the associated variables efficiently.
please go through the below community links:
Solved: How to check if a RITM variable has value in appro... - ServiceNow Community
Solved: Showing Request Item / Catalog Variables in Mail S... - ServiceNow Community
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
56m ago
Hi @Emine
To Display RITM related info like item, Requested For, and Variables etc. in an approval notification running on the sysapproval_approver table, you must use Email Scripts to check if the approval is related to a RITM and fetch those specific details.
Sample code you will get in this post:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
52m ago
if you are talking about the OOTB notification on sysapproval_approver then
-> you need to create an email script and include that in your email body
-> in email script check what's the source table
I hope you know how to include email script in email body
(function runMailScript(current, template, email, email_action, event) {
var sourceTable = current.source_table;
if (sourceTable == 'sc_req_item') {
// add your logic to print
var ritmSysId = current.sysapproval;
var gr = new GlideRecord("sc_req_item");
gr.addQuery("sys_id", ritmSysId);
gr.query();
if (gr.next()) {
template.print("Item: " + gr.cat_item.name);
template.print("Requested For: " + gr.request.requested_for.name);
// add logic to print variables you want
var variables = gr.variables.getElements();
for (var i = 0; i < variables.length; i++) {
var question = variables[i].getQuestion();
var label = question.getLabel();
var value = question.getDisplayValue();
if (label != '' && value != '') {
template.print(label + " = " + value + "<br/>");
}
}
}
}
})(current, template, email, email_action, event);
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
