get list of approvals from RITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2020 04:19 AM
Hi everyone,
I want to get the list of approvals related to RITM.Please help me with script.
var appr=[];
var gr=new GlideRecord("sysapproval_approver");
gr.addQuery('sysapproval',current.sysapproval.sys_id);
//gr.addEncodedQuery('sysapproval=9403d117db163218730e0e41ca96197d');
gr.query();
while(gr.next()){
gs.log("list of approvers "+ appr.push(gr.approver));
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2020 01:34 PM
the logic for query is wrong that why you are not getting results, on sysapproval_approver table you dont have to pass sysapproval.sys_id but instead if you look at the sysapproval_approver table, request item is present as reference hence you should pass sys_id for current request item, make below changes in your code
gr.addQuery('sysapproval',current.sys_id);