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

Prevent a specific notification to not be CC to the delegates

sylvainhauser
Mega Explorer

Do you know how to prevent a specific notification to be sent to the user delegates?

In a system shared by IT and HR, we need to have the delegation available for IT, available for HR Fulfillers, but the requestor personal notifications should not be shared with your delegates...

The business case is simple:

- Mike, Service Desk user, has a personal HR case: an HR case is created where he's set as requestor

- Mike is going away for 2 weeks on holidays, so he sets up a colleague (John) as delegate

- While he's away, HR is updating his HR case, so he (Mike) receives an email with the new additional comments with some personal information

=> But because of the delegation, his colleague John is in CC of the notification...

I can't see an option in the email definition to force to only send notifications to the users / groups defined, and not their delegate.

The only design I can see is "dangerous" (onBefore Insert BR, I can detail it if you want) as more than 7000 emails are sent everyday...

Inactivating the delegation is not an option (as it's very useful for 99% of the notifications).

Any idea of a nice solution for this?

1 ACCEPTED SOLUTION

brumiou
Mega Guru

I've the same issue (IT and facilities) and I've found a little workaround...



In the notification, I don't put the users in the "who will receive" but I add them in cc with the mail script email.addAddress("cc",email,name);




In this case, the delegates are bypassed.



but it refuse to send a mail without anybody in the "to", si I just put a mail address created for this specific reason.



it's ugly but it works


View solution in original post

16 REPLIES 16

manikorada
ServiceNow Employee
ServiceNow Employee

Sylvain,



There is no OOTB for this. what you can do is have a business rule on sys_email which runs on insert and check if the email is for any specific notification, if yes then remove the delegate from the Recipients.


Unfortunately, that's the issue.



There is no link between the email sent (sys_email) and the notification definition (need to use the email log) or the users (we only know the email addresses).




So it means, to do a BR on before insert of the sys_email table:


    • Link the email sent (sys_email) to the notification content (sysevent_email_action) using the email log sys_email_log as there is no direct link between sysevent_email_action and sys_email
    • Check if the notification definition (sysevent_email_action) linked to the email has been set to not CC users
    • If yes, check if any of the users (matched using the email address as unique identifier) has any active delegate (sys_user_delegate)
      • if yes, empty the recipients (out of the box freetext field)
      • fill the back the recipients field with only the users defined originally without the delegates based on the notification definition (dynamically using the users, groups, Users/Groups in fields at the sysevent_email_action level)



So as you can see, it's a lots of work, and can potentially have performance impacts (as the first 2 steps have to be done for each email sent, meaning 7000/day, mostly on pick hours)...




That's why I'm looking for some help to get a smarter way to do it to avoid any bad surprise...


I spoke to one of our Product Managers, Mike Malcangio, about this last night at our Knowledge conference.   He is going to look at it for you and make a recommendation.   This is something we'd like make easier in the product moving forward.  


Great. I'm in K15 as well if you want to discuss about it > @sylvainhauser on twitter !