- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2023 06:37 AM - edited 01-14-2023 06:49 AM
Our instances have Notification Activity Stream @ Mention Email enabled.
When this feature is used to notify people, they get an e-mail notification for the demand task and then another e-mail notification for the overall demand (since work notes are automatically copied from the DMNDTSK to the parent demand - triggering the 2nd email notification).
- A user is unable to filter using the notification preferences in the user's profile. Only option is to turn Activity Stream @ Mention Email off or on.
- Definitely do not want to stop automatic copy of work notes to the parent demand if that is even possible.
- Only solutions I can think of is to somehow edit the scrip for the notification or the user would have to create their own filtering rule on their e-mail client.
- An idea is to add a filter condition based upon the live_notification table. Currently researching this.
If anyone has any idea on how to filter to avoid users receiving duplicate notifications triggered when the parent demand receives a copy of demand task work notes, I'd appreciate it. Thank you.
function shouldSend() {
var liveGroupProfileGR = new GlideRecord("live_group_profile");
liveGroupProfileGR.setWorkflow(false);
liveGroupProfileGR.addQuery("document", current.document);
liveGroupProfileGR.addQuery("table", current.table);
liveGroupProfileGR.addQuery("type", "!=", "support");
liveGroupProfileGR.query();
if(liveGroupProfileGR.next()) {
var liveGroupMemberGR = new GlideRecord("live_group_member");
liveGroupMemberGR.setWorkflow(false);
liveGroupMemberGR.addQuery("group", liveGroupProfileGR.getUniqueValue());
liveGroupMemberGR.addQuery("member", current.profile);
liveGroupMemberGR.addQuery("state", "!=", "inactive");
liveGroupMemberGR.query();
if(liveGroupMemberGR.next()) {
return false;
}
}
var SecurityManager = new SNC.LiveFeedSecurityManager();
return SecurityManager.canReadField(current.user, current.table, current.document, current.field_name);
}
shouldSend();
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2023 10:03 AM
This script appears to be checking for certain conditions before sending a notification for a specific document, table, and field in the system. To prevent duplicate notifications for the same parent demand when work notes are copied from the demand task, you could add a condition to this script that checks if the current notification is for the parent demand and only sends the notification if the work notes have not been previously copied. One way to do this would be to check the live_notification table for a previous notification with the same parent demand and work notes, and only send the new notification if there is no match. Another option would be to add a flag to the demand task that indicates whether the work notes have been copied to the parent demand, and only send the notification if that flag is false. Additionally, you could also look into creating a custom filter on the user's email client to sort and filter these emails as per their requirement.
It would depend on the specific requirements for your system and how you want to prevent the duplicate notifications. If you decide to check the live_notification table for previous notifications, you would need to modify the script to include that check. If you decide to add a flag to the demand task, you would need to create a new field on the demand task table and update the script to check that field before sending the notification. It's also worth considering if there are other solutions like adding a filter on the user's email client, which may be less complex and less prone to errors than modifying code. It would be a good idea to test the changes thoroughly before implementing it in production to ensure that it works as intended and that it doesn't break any existing functionality.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2023 10:03 AM
This script appears to be checking for certain conditions before sending a notification for a specific document, table, and field in the system. To prevent duplicate notifications for the same parent demand when work notes are copied from the demand task, you could add a condition to this script that checks if the current notification is for the parent demand and only sends the notification if the work notes have not been previously copied. One way to do this would be to check the live_notification table for a previous notification with the same parent demand and work notes, and only send the new notification if there is no match. Another option would be to add a flag to the demand task that indicates whether the work notes have been copied to the parent demand, and only send the notification if that flag is false. Additionally, you could also look into creating a custom filter on the user's email client to sort and filter these emails as per their requirement.
It would depend on the specific requirements for your system and how you want to prevent the duplicate notifications. If you decide to check the live_notification table for previous notifications, you would need to modify the script to include that check. If you decide to add a flag to the demand task, you would need to create a new field on the demand task table and update the script to check that field before sending the notification. It's also worth considering if there are other solutions like adding a filter on the user's email client, which may be less complex and less prone to errors than modifying code. It would be a good idea to test the changes thoroughly before implementing it in production to ensure that it works as intended and that it doesn't break any existing functionality.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2023 08:32 AM
Thank you KMohammed. I appreciate the detailed suggestions. I'll mark accept as solution.