How to get the sys_id of the approval record generated from the approval activity in workflow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2019 12:30 AM
Hi,
I have a "Approval-User" activity in my workflow. How do I get the sys_id of the approval record that this activity creates?
Thank You!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2021 08:40 AM
Hi Shruthi, Did you get a solution for this? I am in need of the same

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2021 09:03 AM
If you have the current record and the sys_id of the stage you can get the sys_id of the approval record.
var aaprovalRec = new GlideRecord('sysapproval_approver');
aaprovalRec.addQuery('document_id','current.sys_id'); //current record for which the approval is attached
aaprovalRec.addQuery('wf_activity.stage',stageSysID); //sys_id of the stage in wf_stage
aaprovalRec.query();
if(aaprovalRec.next()){
gs.print(aaprovalRec.sys_id.toString());
}