How to get the sys_id of the approval record generated from the approval activity in workflow?

Community Alums
Not applicable

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?

find_real_file.png

 

Thank You!

6 REPLIES 6

Vinayak Belgaon
Mega Guru
Mega Guru

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());
}

Community Alums
Not applicable

Hi Vinayak,

 

Thank you for your reply!

Any idea how I can grab hold of the sys_id of my 'Approval-User' activity stage in the Run Script activity that succeeds it?

 

Thanks!

Go to the wf_stage Table. And find the Activity name in your case its "Approval - User" where the  Workflow Version is the Name of Your Workflow

find_real_file.png


Hit thumsUp if you think it was helpful



Regards

Vinayak

Vinayak Belgaon
Mega Guru
Mega Guru

Go to Table wf_stage. Search for the activity name in the "Name" column, in your case search for "Approval-User". Check for the worfklow version with the workflow name. and you can grab the sys_is of that record.






Hit thumbs up if you find it useful.

 


Regards

Vinayak