Preventing Duplicate Change Approval Notifications in Change Request Workflow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2024 01:50 AM
In our Change Request workflows, there are instances where the Group Approval Activity needs to be retriggered, typically when change managers need to add services, CIs, or regions. This action generates additional approvers. However, it results in the Change Approval Notification being sent again to all Approvers, including those who were previously notified.
We're seeking a solution to prevent duplicate notifications from being sent to Approvers on the same day. Ideally, we're looking for functionality that can automatically abort the sending of a notification to a user if the same notification (with identical subject and recipient) has already been sent earlier in the day.
We believe that a Notification Advanced condition could potentially address this issue. Specifically, we're exploring the possibility of implementing a condition that checks whether the subject and the recipient are the same as those of a previously sent notification on the same day. If they match, the condition would instruct the system to ignore triggering the notification, effectively preventing duplicates.
Here is as far as i got with my script, but the log shows Recipients: undefined.
Any insights or suggestions on how to achieve this functionality this way or another would be greatly appreciated. Thank you!
// Check if the recipient has already received a notification with the same subject
var recipients = current.recipient_fields.toString().split(","); // Splitting list into an array of recipients
var subject = current.subject;
gs.log("RS NOTIF: Recipients: " + current.recipient_fields.toString()); // Logging the list of recipients
for (var i = 0; i < recipients.length; i++) {
gs.log("RS NOTIF: Processing Recipient: " + recipients[i]);
}
var gr = new GlideRecord('sys_email');
gr.addQuery('recipient_fields', 'IN', recipients);
gr.addQuery('subject', subject);
gr.addQuery('sys_created_on', '>=', gs.beginningOfToday()); // Optionally, limit the check to notifications sent today
gr.query();
if (gr.hasNext()) {
// If a record with the same recipient and subject exists, do not send the notification
gs.log("RS NOTIF: Notification with the same recipient and subject exists. Not sending the notification.");
answer = false;
} else {
// Send the notification if no record with the same recipient and subject exists
gs.log("RS NOTIF: No previous notification found with the same recipient and subject. Sending the notification.");
answer = true;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2024 02:54 AM
Process wise: shouldn't the already given approvals be canceled, once the Change is changed?
I receive an email, I open the record, see it is good, go get some coffee, get to talk to my manager, offering me a promotion, so I go out and buy everyone cake. After the celebration is done, I suddenly think about that approval. I to to the approval record and click 'approve', because it's still on 'requested'.
I would make the change read only on awaiting approval, with a 'correct change' button for the change managers and when using that button, all approvals are cancelled. And in that case, an approver is going to approve on a different approval record. This process may also get the change managers to think twice before asking for approval on an incomplete/incorrect change.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2024 03:16 AM
In our Change Request workflows, there are instances where the Group Approval Activity needs to be retriggered, typically when change managers need to add services, CIs, or regions.
Atul: Adding New Ci / Servce other new state may cause issue in conflict detection.
This action generates additional approvers. However, it results in the Change Approval Notification being sent again to all Approvers, including those who were previously notified.
Atul: Yes, it is OOTB.
We're seeking a solution to prevent duplicate notifications from being sent to Approvers on the same day. Ideally, we're looking for functionality that can automatically abort the sending of a notification to a user if the same notification (with identical subject and recipient) has already been sent earlier in the day.
Atul: I think not a valid way, bcz if an new CI has been added, the all approvers must get a notification, that some thing new has been added and previous approver need to approve again.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************