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

Delegate isn't receiving emails

Allison3
Kilo Guru

I have set up a delegate for myself but the delegate isn't receiving any of the emails I get.

I followed the instructions here: Role Delegation - ServiceNow Wiki

Verified the user is an active user. All 4 options are selected. I am a System Admin and she has an ITIL role. Not sure if this plays into it at all but I didn't find any documentation on it.

 

Any reason as to why she isn't getting the emails or assignments?

1 ACCEPTED SOLUTION

Allison3
Kilo Guru

After opening a ticket in HI, ServiceNow advised this is a known issue in Dublin.



A workaround that you may take is that in the email notification, please go ahead and add the following mail script to the message:



Add this mailscript to the email notification.The script looks up the members of the assignment group, looks at each member's user record to see if they have a delegate active and if that delegate has notifications enabled and then adds the delegate's email address to the "cc" field.


<mail_script>


var grp = new GlideRecord('sys_user_grmember'); 
// lookup the members of the group
grp.addQuery('group',current.assignment_group); 
grp.query(); 
while (grp.next()) { 
// see if the user has a delegate assigned at this time 
   var delegate = new GlideRecord('sys_user_delegate'); 
   delegate.addQuery('user',grp.user); 
   delegate.addQuery('starts','<=',gs.nowNoTZ());
   delegate.addQuery('ends','>=',gs.nowNoTZ()); 
   delegate.query(); 
   while (delegate.next()) { 
// get the email address of the delegate if they have notification enabled
       var usr = new GlideRecord('sys_user'); 
       usr.addQuery('sys_id',delegate.delegate); 
       usr.addQuery('notification','2'); 
       usr.query();
       while (usr.next()) { 
// add the delegate's email to the "cc" list
           email.addAddress("cc", usr.email,usr.name);
       } 
   }
}
</mail_script>


View solution in original post

9 REPLIES 9

Allison3
Kilo Guru

After opening a ticket in HI, ServiceNow advised this is a known issue in Dublin.



A workaround that you may take is that in the email notification, please go ahead and add the following mail script to the message:



Add this mailscript to the email notification.The script looks up the members of the assignment group, looks at each member's user record to see if they have a delegate active and if that delegate has notifications enabled and then adds the delegate's email address to the "cc" field.


<mail_script>


var grp = new GlideRecord('sys_user_grmember'); 
// lookup the members of the group
grp.addQuery('group',current.assignment_group); 
grp.query(); 
while (grp.next()) { 
// see if the user has a delegate assigned at this time 
   var delegate = new GlideRecord('sys_user_delegate'); 
   delegate.addQuery('user',grp.user); 
   delegate.addQuery('starts','<=',gs.nowNoTZ());
   delegate.addQuery('ends','>=',gs.nowNoTZ()); 
   delegate.query(); 
   while (delegate.next()) { 
// get the email address of the delegate if they have notification enabled
       var usr = new GlideRecord('sys_user'); 
       usr.addQuery('sys_id',delegate.delegate); 
       usr.addQuery('notification','2'); 
       usr.query();
       while (usr.next()) { 
// add the delegate's email to the "cc" list
           email.addAddress("cc", usr.email,usr.name);
       } 
   }
}
</mail_script>


Hi Allison,


Is your scenario apply to email notification only? Or does it involve approvals and/or task as well?


Thanks,


Dor


It was applying for all emails in ServiceNow that were sent to me, notifications/tasks. We don't currently use approvals.


mrcarter
Tera Contributor

Would really appreciate some help on delegates and email notifications please.   We have found a security loophole on our instance whereby if a user requests a password reset and they have delegates setup on the self service portal, the password reset is sent to their delegates as well.   Can anyone advise.   I thought by removing email from the who is this sent to and ticking the send to creator might do it but this just meant to no email was sent.


Hey Damian, We have since upgraded to Eureka. We also don't do password resets through ServiceNow so unfortunately I don't think I can provide much insight. I would suggest opening a ticket through HI. They will be able to tell you if this is working as designed or if there is an underlying issue.