Prevent "duplicate" outbound email notifications (Comment / Work_notes)

kjcv912
Kilo Contributor

We have HR Case Email Notifications for both:

*Comments

*Work_notes

Sometimes the desk agent update one field, SAVE and update next field + hit the SAVE button, 2 emails will be sent.

The Business Rule "Ignore duplicates" seem not to prevent this type of "duplicate".

Business has requested me to prevent duplicate outbound notifications and so far have I briefly looked into using javascript in the notification checking for same email in Mailbox-Outbound-Outbox within a short timeframe (mark duplicate as "skipped")

Are there even more options/ideas how to prevent duplicate emails to be sent?

/Stefan

14 REPLIES 14

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Generally, these notifications are sending to different people, so why would you need to mute one?



If the assigned to person updates the comments then the caller and watch list would usually get an email. If they update the work notes then the work notes list would get the email. Who is receiving duplicates?


kjcv912
Kilo Contributor

I asked for a real HR Case as evidence and now does it turn out to be more complex but still something that needs to be addressed.



To the HR Case used as evidence there is a HR task that were updated 3 times within a short timeframe.


The 3 task updates were added to the HR Case comment field as 3 updates, each update seem to have trigger one "HR Case ......comments added" notification.


3 outbound emails were created within 4 seconds with the same recipient, subject and body so I can understand that the receiver didn't appreciate this.



I start to believe that current weight = 0 (default value) prevent "Ignore duplicates" business rules to skip 2 duplicates.
Do I need to set a WEIGHT value on the Email Notification "HR Case commented" to get this BR to ignore duplicates?


Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Stefan,



The weighting only comes into play if you have different email notifications possibly sending out on the same update. Since your situation has multiple updates, the event gets fired multiple times with multiple email notifications running. I think the simplest solution would be to train hr process users that each time they add notes they're triggering emails to the customer. There are probably other ways around this, maybe they have to manually hit something to trigger the email or you have a business rule on the email table that does something, but it would be complex.


Hi Brad



here are some statements from the BR "ignore duplicates"


  // Search for any pending email with the same recipients from the same ticket


    var duplicate = new GlideRecord('sys_email');


    duplicate.addQuery('instance', myInstance);


    duplicate.addQuery('recipients', myRecipients);


    duplicate.addQuery('type', 'send-ready');


    duplicate.addQuery('weight', '>', '0');


...



the query statement 'weight', '>', '0' will that be a blocker for my notifications with weight 0 (zero)?


my interpretation is that the BR won't look at my duplicates