- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2025 01:57 PM
var requestID = '6f6416e5476c6610872475f4116d43d8';
//Find all approvals where the parent is the same.
var approvalQuery = new GlideRecord('sysapproval_approver');
approvalQuery.addQuery('sysapproval.parent', requestID);
approvalQuery.query();
while(approvalQuery.next())
{
gs.info(approvalQuery.sysapproval.sys_id);
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2025 07:24 AM
ServiceNow support was able to figure out a solution:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2025 02:26 PM
Hi @Bill Wulff ,
Please replace
gs.info(approvalQuery.sysapproval.sys_id);
With
gs.info(approvalQuery.sys_id);
If my response helped then please accept the solution and hit the thumbs up so that it benefits future reader.
Regards,
Rohit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2025 05:52 AM
This did not work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2025 08:03 PM
requestID -> holds REQ sysId?
For your requirement here is the background script which you can try
var count = 0;
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('approver', approverSysId);
gr.addQuery('approval_for.parent', parentSysId);
gr.query();
while (gr.next()) {
count++;
}
if (count == 1) {
gs.eventQueue('single_approval_email', gr, gr.sys_id, gr.approver);
} else if (count > 1) {
gs.eventQueue('multiple_approvals_email', gr, gr.sys_id, gr.approver);
}
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
‎03-28-2025 05:59 AM
Yes, the requestID holds the sys_id of the request.
I was not able to get your script to work.
I don't think the system likes the gr.addQuery('approval_for.parent', parentSysId); query.
I think it has something to do with the "Approval For" field being a reference field of the Task table.