Prevent non-admin users from modifying, adding, or removing columns in the Default list view layout
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago - last edited 3 hours ago
Hello,
We have a requirement to prevent non-administrator users from adding or removing columns in the default list layout across all tables.
We attempted to address this using Before Business Rules on the sys_ui_list and sys_ui_list_element tables.
Business Rule 1 (on sys ui list)
- Filter Conditions: View is Default view
- Applied on : Insert , Update , Delete
- Condition: !gs.hasRole('admin')
- Script: Aborts the action and displays an error message.
Business Rule 2 (on sys ui list element)
- Filter Conditions: List ID.view is Default view
- Applied on : Insert , Update , Delete
- Condition: !gs.hasRole('admin')
- Script: Aborts the action and displays an error message.
During testing, we found that while the default list layout successfully restricts users from adding new columns via Configure > List Layout, the system concurrently deletes all other existing fields from the default view.
Does any one work on the same / any idea for this ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
default list layout can only be configured by users with personalize_list role
why this requirement?
I will recommend not to play with system tables such as those involved for views, lists etc
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hello @Ankur Bawiskar ,
Thank you for your response.
We observe that removing the personalize_list role successfully prevents users from seeing the Configure > List Layout option.
However, the specific requirement from the client is to ensure that the only default list view layout is uneditable for all non-administrator users across the platform.
Do we have any alternate solution for this requirement ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
share scripts from both the business rules
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hello @Ankur Bawiskar ,
We have used below script in Business Rule
Business Rule 1 (on sys ui list)
- Filter Conditions: View is Default view
- Applied on : Insert , Update , Delete
- Condition: !gs.hasRole('admin')
- Script:
(function executeRule(current, previous /null when async/ ) {
gs.addErrorMessage('You are not allowed to modify the Default View layout.');
current.setAbortAction(true);
})(current, previous);
Business Rule 2 (on sys ui list element)
- Filter Conditions: List ID.view is Default view
- Applied on : Insert , Update , Delete
- Condition: !gs.hasRole('admin')
- Script:
(function executeRule(current, previous /null when async/ ) {
gs.addErrorMessage('You are not allowed to modify the Default View layout.');
current.setAbortAction(true);
})(current, previous);