How to get the reference record for Group approvals?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2024 02:48 AM
I have a Notification 'Approval request for exception' which is OOB on Approvals [sysapproval_approver] table. It contains the Notification email script 'sn_vul_exception_request_to_group'. Now, that I have changed the Notification table to Group Approval [sysapproval_group], the body of Notification is now blank as it is not getting any reference record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2024 03:37 AM
@ArpitaVK
try this code now
(function runMailScript(current, template, email, email_action, event) {
var subject, body, vulRecordLink, reqDetails, vulDetails;
var util = new VREmailUtils();
// Retrieve the referenced record from the 'parent' field
var appr_Record = current.parent.getRefRecord();
// Retrieve the referenced record from the 'vul_record' field on the 'appr_Record'
var vul_record = appr_Record.vul_record.getRefRecord();
// Get the link to the vulnerability record
vulRecordLink = util.getVulLink(vul_record);
// Split the 'approvers_list' into an array if it's not empty
var approversArr = appr_Record.approvers_list != '' ? appr_Record.approvers_list.split(","): '';
// Construct the email body
body = gs.getMessage("Hi Exception Approver,<br/><br/>An exception request has been submitted by {0} on {1} to defer {2}.<br/><br/>Please review and approve this request as soon as possible. Additional details are as follows:<br/><br/>", [util.getUserName(appr_Record.requested_by), '${sys_created_on}', vulRecordLink]);
template.print(body);
// Print approver details if there are any
if(approversArr.length > 0){
appDetails = gs.getMessage("Approver name: {0}<br/><br/>", [util.getUsersName(approversArr)]);
template.print(appDetails);
}
// Print request details
reqDetails = util.getRequestDetailsForException(appr_Record);
template.print(reqDetails);
// Print vulnerability details
vulDetails = util.getVulnerabilityDetails(vul_record);
if (vulDetails) {
template.print(vulDetails);
}
})(current, template, email, email_action, event);