- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2024 09:55 PM
Hi,
Our customer instance is domain separated and has multiple regions(like APAC, US etc.,). Some of the users are complaining that they are receiving too many email notifications for incident/RITM/Change commented etc., Is it possible for the admin to disable these notifications by default for users based on their regions? The users can later enable the required notifications by enabling them in their preferences. Many Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2024 01:17 AM
Hi @Chitra23 ,
if you want to turn off few notifications for the users try this
you can run a fix script something like this.
you can identify the users based on countries and run the fix script per country.
and create a BR with same logic to take care of new users.
var usrGr = new GlideRecord("sys_user");
var notifPrefGr = new GlideRecord('sys_recipient_notif_preference');
usrGr.addEncodedQuery("location.country=JAPAN"); // query based on user's country
usrGr.setLimit(10);
usrGr.query();
while (usrGr.next()) {
//array of notifcation sysids can be added here
notifPrefGr.newRecord();
notifPrefGr.notification_table = 'sysevent_email_action';
notifPrefGr.recipient_table = 'sys_user';
notifPrefGr.recipient = usrGr.getValue('sys_id');
notifPrefGr.notification = '3c705e2847ee42108ab7916a216d4350'; //sysid of the notification
notifPrefGr.send = false;
notifPrefGr.insert();
}
if you want to disable all the notifications for the users try this.
disable the notification devices of the user.
var usrGr = new GlideRecord("sys_user");
var ntfDevGr = new GlideRecord('cmn_notif_device');
usrGr.addEncodedQuery("location.country=JAPAN"); // query based on user's country
usrGr.setLimit(10);
usrGr.query();
while (usrGr.next()) {
ntfDevGr.addEncodedQuery('name=Primary email^type=Email^active=true^user='+usrGr.getValue('sys_id'));
ntfDevGr.query();
if(ntfDevGr.next()){
ntfDevGr.active =false;
ntfDevGr.update();
}
}
A BR to take care of new Users.
Please mark the answer as helpful and correct if helped.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2024 10:22 PM
Hello @Chitra23
Can you try looking at cmn_notif_messages.
The cmn_notif_message tables stores all the email subscription on the instance.
You might have to modify/add few records there.
Please mark the answer as helpful and correct if helped.
Kind regards,
Ravi Chandra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2024 11:54 PM
Hi @Chitra23
I think in this case you need to correct your email as per regions / domain. If you speak from user side then a user can disable it at preference table. You can explore this:
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]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2024 10:16 PM
Hi @Dr Atul G- LNG , Thanks for your response. Instead of asking each and every user to disable notifications, Is it possible for admin to bulk disable these notifications for users?
What happens when the user disables (for e.g. incident commented notification ) from the notification preference page? Which table store these data?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2024 01:23 AM
Hi @Chitra23
No. There is no backend view ( only with scripts) it is possible to turnoff specific notifications for users. So either build a code or asked user to turn off.
What happens when the user disables (for e.g. incident commented notification ) from the notification preference page? Which table store these data?
Atul: In this case, that email will not land in users inbox. sys_user_preference in this table.
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]
****************************************************************************************************************