- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2019 08:50 AM
Hello All,
I am new to ServiceNow, I am studying UI Policy and Client Scripts.
I know they both runs on Client side, Can some one please give me a real life use case scenarios, Ex : [ where to use what ]
If possible, can you please provide me multiple use case scenarios.....
i was following this article ::
Thank You...
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2019 09:28 AM
Real Time Scenario :
UI Policy : if you want to make your form field "Mandatory" "Read Only" "Visible" based on some field condition or browser load then you can simply use UI Policy here.
Let's take an example : i want to make work notes field mandatory based on the state field value. so this is a simple straight forward requirement. so here i will go with UI Policy.
i will Create an UI Policy and set the filter condition State | IS | Resolved then in the UI Policy action i will set true for Work notes field.
If you have a similar requirement but the work notes field should be mandatory on form Submission then you have to use here onSubmit Client script because in UI Policy you can either set it on field change or form load ( only in these two scenario you can run the UI Policy ).
But Client script can be run on either onLoad() , onChange() , onSubmit() or onCellEdit().
Now Coming to the Client SCript:
if you have a scenario here , to populate some field value in short description field. example:
I want to set CAller title in to the short description then here you can write onChange() client script on caller field to get the caller title value and set into the short description field.
Now you compare the first example and the second example, you will see the complexity in the requirement.
this way you can decide on which scenario you should use UI Policy and Client Script.
I am adding one TechNow Episode here . this is specific to the client script.
TechNow Episode 5 | Client-Side Scripting Fundamentals
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2019 06:22 AM
Nice, Thank you

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2019 05:50 AM
some field condition or browser load then you can simply use UI Policy here.
Let's take an example : i want to make work notes field mandatory based on the state field value. so this is a simple straight forward requirement. so here i will go with UI Policy.
i will Create an UI Policy and set the filter condition State | IS | Resolved then in the UI Policy action i will set true for Work notes field.
If you have a similar requirement but the work notes field should be mandatory on form Submission then you have to use here onSubmit Client script because in UI Policy you can either set it on field change or form load ( only in these two scenario you can run the UI Policy ).
But Client script can be run on either onLoad() , onChange() , onSubmit() or onCellEdit().
Now Coming to the Client SCript:
if you have a scenario here , to populate some field value in short description field. example:
I want to set CAller title in to the short description then here you can write onChange() client script on caller field to get the caller title value and set into the short description field.
Now you compare the first example and the second example, you will see the complexity in the requirement.
this way you can decide on which scenario you should use UI Policy and Client Script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2019 06:30 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2019 09:42 PM
hi
ui policy can be used to make fileds on form visible, readonly, manadtory or clear some field values.
while, client script can be used to perform some complex logic with the above functionallity.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2020 12:23 AM
Check out this video, it will clear all your doubts and help you to understand Client Script queries in details.
Link: https://www.youtube.com/watch?v=Wj8ZAWtTBqo&ab_channel=ServiceNowHelpdesk
It help you to understand below points.
- UI policy and Client script
- why client script run first in service now?.
- Which rule execute first client Scripts or UI polices?
- g_user and g_form tips
- Difference between client script and script include (server).
- Scenario based implementation
- Understanding below
- onLoad()
- onChange()
- onSubmit()
- onCellEdit()
Please mark reply as Helpful/Correct, if applicable. Thanks!!