Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Add Approver History to notification

achen
Tera Contributor

Hello,

 

I am attempting to pull the approval history from a ritm and add it to a notification.  I have added this email script 

var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('sysapproval', current.sys_id);

gr.addQuery('state',approved);gr.query();

while(gr.next()){
template.print('Details');
}

but it pulls all approvers from the approval table and not the approvals for the current ritm.

 

Thank you,


Alex

1 ACCEPTED SOLUTION

Aman Kumar S
Kilo Patron

Hey,

I think your query for approved is incorrect, shouldn't it be

gr.addQuery('state','approved')// quotes are missing

 

Feel free to mark correct, If I answered your query.

Will be helpful for future visitors looking for similar questions 🙂

Best Regards
Aman Kumar

View solution in original post

6 REPLIES 6

You are printing only string "Details", how will it fetch the history of approval?

If you want to pull the history try pulling different fields :

template.print(gr.getValue("approver") + "   "+gr.getValue("state"));

 

Best Regards
Aman Kumar

Thank you very much! Got it to work.