Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Prevent non-admin users from modifying, adding, or removing columns in the Default list view layout

Chinmay_P
Tera Contributor

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 ?

5 REPLIES 5

@Chinmay_P 

code looks fine.

You will have to debug.

Even if you raise case with ServiceNow they won't help much regarding this as this is a custom solution

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader