dot walking to approver name from sc_req_item record

Ruchi19
Mega Contributor

i m trying to get the approver name of the requested item by dot walking from the current object.
current object is of requested_item.

any suggestion?

current.approval gives me the approval state but how do i get who are approvers for this current record?

2 REPLIES 2

DrewW
Mega Sage
Mega Sage

You need to query the sysapproval_approver table as far as I am aware.



var gr = new GlideRecord("sysapproval_approver");
gr.addQuery("sysapproval", current.sys_id);
gr.query();
while(gr.next()) {
}


Mark Stanger
Giga Sage

You can't dot-walk to an approver because there can be many approvers on a given task. For this same reason, you can't reliably determine who the current approver is. I think the best you could do would be to query the sysapproval_approver table for any approval records that were in a 'requested' state.



var app = new GlideRecord('sysapproval_approver');
app.addQuery('sysapproval', current.sys_id);
app.addQuery('state', 'requested');
app.query();
while(app.next()){
//Do something
}