The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Sending Copy of approval notificaiton to the Requested for of the RITM

Walter Toney
Tera Expert

I have been asked to send a copy of an approval notification to the Requested for of the RITM that was submitted. and i tried to dot walk to add the requested for but it's not working.. does anyone have a good clean way to make this happen?

3 REPLIES 3

Rafael Batistot
Kilo Patron

Hi @Walter Toney 

May use a mail script

A mail script allows you to query the sc_req_item table directly to get the "Requested for" information and include it in your notification.

 

 1 - Navigate to System Policy > Email > Notifications. Open your existing approval notification (or create a new one). This notification should be on the Approval [sysapproval_approver] table.

 

2 - Navigate to System Policy > Email > Email Templates. Create a new mail script.

  • Name: get_ritm_requested_for
    Script:
(function runMailScript(current, template, email, email_action, event) {
    // Check if the approval is for a Requested Item
    if (current.sysapproval.sys_class_name == 'sc_req_item') {
        // Get the RITM record
        var grRITM = new GlideRecord('sc_req_item');
        if (grRITM.get(current.sysapproval.sys_id)) {
            // Set a variable in the template for the Requested For's name
            template.print('Requested For: ' + grRITM.requested_for.getDisplayValue());
        }
    }
})(current, template, email, email_action, event);

 

3 - Navigate back to your notification.
4 - In the What it will contain section, add the mail script to the email body using the following syntax: ${mail_script:get_ritm_requested_for}

Ankur Bawiskar
Tera Patron
Tera Patron

@Walter Toney 

2 ways to handle

1) you can use email script and add that in the OOTB email script and send the email as CC to that user

OR

2) use before update business rule on email log table and dynamically add the Copied field with RITM->Requested For

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Walter Toney 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader