Do UI policies work on list view?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2023 11:26 PM
The UI policies work when the incident is opened , but on list view it does not . How to fix the issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2023 11:33 PM
In ServiceNow, UI Policies typically work on individual form records rather than on list views. However, if you want to control the display of certain fields or make them read-only within a list view, you can use Client Scripts or UI Actions. Here's how you can achieve this:
Using Client Scripts for List View:
Create a Client Script: Go to "System Definition" > "Client Scripts" and create a new Client Script.
Configure the Client Script:
Table: Choose the table for which you want to apply the UI behavior in the list view.
Type: List
Script: Write JavaScript code to control the field behavior. For example, to make a field read-only:
function onLoad() {
g_list.getColumns().forEach(function(column) {
if (column.getName() === "your_field_name") {
column.setDisplay("true");
}
});
}
Replace "your_field_name" with the actual name of the field you want to control.
Save the Client Script.
Refresh the List View: After creating and saving the Client Script, refresh the list view where you want this behavior to apply.
This Client Script will control the display and behavior of the specified field in the list view.
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
best regards
Anders
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2023 01:02 PM
Hi @Mouktik_B
If my answer has helped with your question, please mark my answer as accepted solution.
Best regards
Anders
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2023 11:34 PM - edited ‎09-05-2023 11:36 PM
Hi @Mouktik_B ,
UI Policies have 2 types - onload and onchange. Hence it will not working in list view.
Client script have 4 types - onload, onchange, oncell edit, onsubmit. you can write on cell edit client script for your business requirements.
You can review below community article for reference:
Thanks & Regards,
Eswar Chappa
Mark my answer correct and Helpful if this helps you 😀

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2023 11:43 PM
Hi,
UI Policies only work on the form, if you want the same behavior in the list you can instead use a Data policy.
These evaluate on server side, so manipulating records in list view will also follow these policies.
(and if you like, the same behavior can be applied on data imports and integrations)
Do note that a data policy will also prevent you from scripting and setting values that is invalid according to the created data policy.