The CreatorCon Call for Content is officially open! Get started here.

How to Get Approver Name?

snow_04
Giga Contributor

Hi,

How can we display the User Name of the approver in the Notification? We have multiple level of approvals(Number of Approvals =4), so when the first approval approves the record, the second approver gets generated using a Business rule, and a Notification is sent to the Approver to approve or reject the request, so how can we sent the name of the first approver in the email being sent to the Second Approver that it has been approved or rejected by the First approver. Similarly tot he third approver with the details of the second approver.

Kindly assist!!

1 ACCEPTED SOLUTION

Hi


Try below code in the message of notification. Update the conditions based on your instance configuration and system setup.



<mail_script>  


    var appRec = new GlideRecord('sysapproval_approver');


    appRec.addQuery('state', 'approved');// if approved is not working put the correct value of the approver state field


    appRec.addQuery('document_id',current.sys_id);


    appRec.query();


    while (appRec.next()) {


      template.print("<ul><li>Approved By: " +appRec.approver.name+"</li></ul>");


    }


</mail_script>  


View solution in original post

3 REPLIES 3

HarshTimes
Tera Guru

Hi Snow learner


YOu can write a mail script in the body of the notification.In the script call the approver table and add the query to find result only for the current record. This will give you list of all approvers generated for the related record.You can get the approver name from this script



-harsh


Hi,



Thank you for your response. Would it be possible for you to please share the Notification script for the solution you proposed above?


Hi


Try below code in the message of notification. Update the conditions based on your instance configuration and system setup.



<mail_script>  


    var appRec = new GlideRecord('sysapproval_approver');


    appRec.addQuery('state', 'approved');// if approved is not working put the correct value of the approver state field


    appRec.addQuery('document_id',current.sys_id);


    appRec.query();


    while (appRec.next()) {


      template.print("<ul><li>Approved By: " +appRec.approver.name+"</li></ul>");


    }


</mail_script>