- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2018 04:55 AM
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!!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2018 06:22 AM
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>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2018 05:39 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2018 06:12 AM
Hi,
Thank you for your response. Would it be possible for you to please share the Notification script for the solution you proposed above?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2018 06:22 AM
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>