Exclude users from receiving notifications

ShubhankarK9612
Tera Contributor

Hi Community,

 

I want to exclude 9 users from receiving notifications and these notifications gets triggered by a schedule Jobs which runs daily. Can I use conditional script in the scheduled Job or do I need to write an email script. 

11 REPLIES 11

M Shivani
Mega Sage

Hi @ShubhankarK9612 ,

 

You can disable all notifications or only specific notifications as needed. To do this, navigate to Profile → Preferences → Notifications. (Ensure that these settings must be configured individually for each user.)

 

If you turn off the main toggle, the user will not receive any notifications.

MShivani_0-1769079137600.png

 

To disable only selected notifications, click the arrow next to System Notifications. Use the search bar to find the required notification and turn it off. This will ensure that only that specific notification is disabled, while all others continue to be received.

MShivani_1-1769079261709.png

 

Please mark it as helpful, if it works for you

 

Thanks,

Shivani

Its_Azar
Kilo Sage

Hi there @ShubhankarK9612 

 

you can handle this directly in the Scheduled Job script. somethnmg like this

var excludedUsers = [
    '46d44f2d1b223010a1b2f1c4cd4bcb12',
    '8a9c3b9d1b223010a1b2f1c4cd4bcb99'
];

var gr = new GlideRecord('sys_user');
gr.addActiveQuery();
gr.query();

while (gr.next()) {
    if (excludedUsers.indexOf(gr.sys_id.toString()) > -1) {
        continue; // skip excluded users
    }


    gs.eventQueue('custom.notification.event', gr, gr.email, '');
}

This works, but keep in mind that embedding exclusion logic in scheduled jobs makes maintenance harder over time. If the list changes often, a group-based exclusion or notification condition/email script is

 

☑️ If this helped, please mark it as Helpful or Accept Solution so others can find the answer too.

Kind Regards,
Azar
Serivenow Rising Star
Developer @ KPMG.