- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-12-2025 09:15 PM
Hi All,
I want the approver name from this Approval (sysapproval_approver) table into the current notification Requested Item (sc_req_item) table.
How do I scripted that.
Regards,
TMKam
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-13-2025 12:35 AM
it should work if there are approval records in Requested state in sysapproval_approver table for your RITM
Did you verify that?
You can comment line 7 and see what it prints.
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
ā06-13-2025 12:42 AM
Hello @TMKAM, you seem to be sending the notification when RITM is cancelled, then approval might be moved out of 'Requested' state. could you please try once more by commenting following line from the code?
approvalGR.addQuery('state', 'requested'); //comment this
Regards,
Nishant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-12-2025 09:43 PM - edited ā06-12-2025 09:44 PM
Hello @TMKAM, you can get the approver details using below script:
var approverName = '';
var approvalGR = new GlideRecord('sysapproval_approver');
approvalGR.addQuery('sysapproval', current.sys_id);
approvalGR.addQuery('state', 'requested'); // optional if looking for only requested items
approvalGR.query();
while(approvalGR.next()){
approverName = approvalGR.approver.getDisplayValue());
}
Regards,
Nishant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-12-2025 10:03 PM
Dear Nishant,
Thank you for the solution and I tried as per below but no reault was shown the in the email notification.
<mail_script>
var approverName = '';
var approvalGR = new GlideRecord('sysapproval_approver');
approvalGR.addQuery('sysapproval', current.sys_id);
approvalGR.addQuery('state', 'requested'); // optional if looking for only requested items
approvalGR.query();
while(approvalGR.next()){
approverName = approvalGR.approver.getDisplayValue());
template.print('Responsible ITC / DVK: '+ approverName +'<br />');
}
</mail_script>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-12-2025 10:15 PM
Hello @TMKAM, Include this code in email script and use in notification, and I believe it should work fine. please verify.
Regards,
Nishant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-12-2025 11:53 PM
hi Nishant,
How to do I that as im pretty new to these scripting.
Thank you