set delegate to get approval emails

Brian Lancaster
Tera Sage

I setup a delegate for a manager who is out of the office.   I have noticed that the delegate is not getting the notifications.   Is there a way to set up the notification to send the email to the delegate as well?

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

Hi Brian,



The system does this by default. Are the delegation dates valid? Is the delegate able to receive email from the system apart from delegation?



Delegate approvals and tasks to another user


View solution in original post

11 REPLIES 11

Eric Jensema
Tera Contributor

At the risk of resurrecting this old thread, I ran into this issue myself today and came up with a fix. The way I'm handling it is with a mail_script. It doesn't exactly match the notification delegation as this will CC the delegate instead of adding to the recipients, but it works for my case. It will even filter out people that already have notifications delegated, so you shouldn't run into any issues with the user in both the To: and CC: fields.

The script is:

(function runMailScript(current, template, email, email_action, event) {

    var approverID = current.getValue('approver');
    var delegateRecords = new GlideRecord('sys_user_delegate');
    var querystring = "starts<=javascript&colon;gs.endOfToday()^ends>javascript&colon;gs.endOfToday()^approvals=true^notifications=false^user=" + approverID;

    delegateRecords.addEncodedQuery(querystring);
    delegateRecords.query();

    while (delegateRecords.next()) {
        if (!gs.nil(delegateRecords.delegate.email + '')) {
            email.addAddress('cc', delegateRecords.delegate.email + '');
        }
    }
})(current, template, email, email_action, event);

 

Then just add the proper ${mail_script:yourScriptName} to your email template, and you're done!

This should not be necessary. If I remember correctly I setup the delegate with the proper dates but uncheck all checkboxes except approval. It seems that you have to leave all notifications check in order for any notification to go out to the delegate. Its bad naming on ServiceNow's part as far as I'm concerned. It technically mean send notification what what is check off in the delegation. Not that they will get all the notification that the user would normally get which is what it sound like. Example below. In read is what can be delegated. Depending on what is check If you don't check all notifications no notifications will go out. So if you check approvals and want the notifications to go out you must check all notification. Typically my users check approvals and all notifications and uncheck everything else.

BrianLancaster_0-1733176136122.png