- 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
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
12-05-2024 09:15 PM
Thank you so much @Chaitanya ILCR sys_recipient_notif_preference is the table I was looking for.