User's Preferences - System Notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 07:10 PM
Hi all,
I want to prevent each users from disabling 'System Notifications' so that user always receive notifications.
Is there any System Propeties to hide this option? or each user's attribute is stored at table and I can create Business rule?
Indivisual User's Preferences > Notifications > System Notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 07:23 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 10:16 PM
Hello @shun6 ,
Client Script
In some cases, you may need a Client Script to enforce the UI policy dynamically.
-
Navigate to Client Scripts:
- In the application navigator, type "Client Scripts" and click on it.
-
Create a New Client Script:
- Click on the "New" button to create a new Client Script.
-
Configure the Client Script:
- Table:
sys_user_preference
- Type: OnLoad
- Script:
- Table:
function onLoad() {
var notificationField = g_form.getField('glide.ui.notification_system');
if (notificationField) {
g_form.setDisplay(notificationField, false);
}
}
- Save the Client Script.
Hide the Notification Preferences Option
To further ensure that users cannot see or interact with the notification preferences, you can hide this option using a UI Policy or Client Script.
-
Navigate to UI Policies:
- In the application navigator, type "UI Policies" and click on it.
-
Create a New UI Policy:
- Click on the "New" button to create a new UI Policy.
-
Configure the UI Policy:
- Table:
sys_user_preference
- Condition:
name == 'glide.ui.notification_system'
- On load: Ensure this is checked.
- Reverse if false: Uncheck this.
- Table:
-
UI Policy Actions:
- Create a new UI Policy Action to hide the field.
- Field name:
value
(or the field representing the notification setting) - Visible: False
-
Save the UI Policy.
Create a Business Rule to Enforce Notification Settings
To ensure users cannot disable system notifications, you can create a Business Rule that prevents the update or creation of preferences that disable notifications.
-
Navigate to Business Rules:
- In the application navigator, type "Business Rules" and click on it.
-
Create a New Business Rule:
- Click on the "New" button to create a new Business Rule.
-
Configure the Business Rule:
- Name: Prevent Disabling System Notifications
- Table:
sys_user_preference
- Advanced: Check the "Advanced" checkbox to write a script.
-
Script:
- Write a script to prevent users from changing the notification settings.
Here's an example of a script to prevent users from disabling system notifications:
(function executeRule(current, previous /*null when async*/) {
// Check if the preference being modified is related to notifications
if (current.name == 'glide.ui.notification_system' && current.value == 'false') {
// Prevent the change by setting the preference back to true
current.value = 'true';
gs.addErrorMessage('Disabling system notifications is not allowed.');
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 10:23 PM
Hi @shun6 ,
Please have a look on below articles to fulfil your requirements:
1. Solved: Re: How to prevent disabling system notification? - ServiceNow Community
2. Solved: Re: Prevent users from disabling their notificatio... - ServiceNow Community
Please appreciate the efforts of community contributors by marking the appropriate response as the correct answer and helpful. This may help other community users to follow the correct solution in the future.
********************************************************************************************************
Cheers,
Prashant Kumar
ServiceNow Technical Architect
Community Profile LinkedIn YouTube Medium TopMate
********************************************************************************************************