- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2022 09:57 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2022 11:11 PM
Hi Sumit,
I see that you are asking very basic questions on the community. If you search correctly, you will find many solutions to these questions which are already provided by the experts. But for this question, you can find my inputs below.
In simple terms, both UI Policy & Client Script are almost similar only thing is scripting is involved in Client script, also client scripts execute first when compared to UI Policies. Always use UI policy for making fields read-only and Mandatory & Hiding.
Client Scripts vs. UI Policies
UI Policies execute after Client Scripts. If there is conflicting logic between a Client Script and a UI Policy, the UI Policy logic applies. Client Scripts and UI Policies both execute client-side logic and use the same API. Both are used to manage forms and their fields. When developing an application, how can you decide which client-side script type to use? Use this table to determine which type is best suited to your application's needs:
Criteria | Client Script | UI Policy |
---|---|---|
Execute on form load | Yes | Yes |
Execute on form save/submit/update | Yes | No |
Execute on form field value change | Yes | Yes |
Have access to field's old value | Yes | No |
Execute after Client Scripts | No | Yes |
Set field attributes with no scripting | No | Yes |
Require control over order of execution | *Yes | Yes |
Note: You can always try to use script in UI policy instead of client script. I personally always use UI policy script instead of client script.
Please mark correct/helpful if applicable.
Regards,
Shubham
Shubham Tipnis
ServiceNow Enthusiast
⭐️ 3x Rising Star (2022–2024) – ServiceNow Community
Sharing insights, use cases & real-world learnings from the Now Platform
Always learning. Always building.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2022 12:46 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2022 12:47 PM
Hi there,
UI policies are used to dynamically change the behavior of information on a form and are used to conditionally make fields visible, read-only, or mandatory.
Client scripts are used to run JavaScript on the client (web browser) when client-based events occur, such as when a form loads, after form submission, or when a field changes value.
Client scripts can do everything that UI policies can do but are more costly on platform performance. Client scripts can also do additionally things which UI policies cannot achieve because they can run JavaScript to do whatever you require.
If this answer is helpful please mark correct and helpful!
Regards,
Christopher Perry
Regards,
Chris Perry

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2022 11:11 PM
Hi Sumit,
I see that you are asking very basic questions on the community. If you search correctly, you will find many solutions to these questions which are already provided by the experts. But for this question, you can find my inputs below.
In simple terms, both UI Policy & Client Script are almost similar only thing is scripting is involved in Client script, also client scripts execute first when compared to UI Policies. Always use UI policy for making fields read-only and Mandatory & Hiding.
Client Scripts vs. UI Policies
UI Policies execute after Client Scripts. If there is conflicting logic between a Client Script and a UI Policy, the UI Policy logic applies. Client Scripts and UI Policies both execute client-side logic and use the same API. Both are used to manage forms and their fields. When developing an application, how can you decide which client-side script type to use? Use this table to determine which type is best suited to your application's needs:
Criteria | Client Script | UI Policy |
---|---|---|
Execute on form load | Yes | Yes |
Execute on form save/submit/update | Yes | No |
Execute on form field value change | Yes | Yes |
Have access to field's old value | Yes | No |
Execute after Client Scripts | No | Yes |
Set field attributes with no scripting | No | Yes |
Require control over order of execution | *Yes | Yes |
Note: You can always try to use script in UI policy instead of client script. I personally always use UI policy script instead of client script.
Please mark correct/helpful if applicable.
Regards,
Shubham
Shubham Tipnis
ServiceNow Enthusiast
⭐️ 3x Rising Star (2022–2024) – ServiceNow Community
Sharing insights, use cases & real-world learnings from the Now Platform
Always learning. Always building.