- 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
05-20-2019 05:50 AM
Hey Thank You All Guys, for Helping.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2019 05:53 AM
if i answered you , kindly mark my answer as correct and close this thread.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2019 06:01 AM
Hi
Both UI Policies and Client scripts are Client (Browser) level scripts.
UI Policies are Out of the box Policies which are given by SNOW to Make fields Hidden/Read-only/Mandatory
with Client scripts we does same things but some complex tasks or Cross validations such as Field to field dependencies can be taken care under client scripts
When ever it is possible to use UI policies it is recommended to use them over client scripts as Client script has Human intervention involved for writing scripts in Java Scripts.
Client scripts are basic Client level scripts where we can achieve form level validations, cross validations.
Please mark helpful or correct Ans if it helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2019 06:27 AM
-Catalog UI policies control the behavior of catalog item forms when presented to your users. Catalog UI policies can be applied to a catalog item or a variable set.
UI policies are useful when applied to service catalog items. Keep the following points in mind when creating service catalog UI policies:
- A catalog UI policy applies to either a specific catalog item or any item that uses a specific variable set.
- A catalog UI policy can only contain and reference variables that are defined for the catalog item or variable set.
- Like UI policy conditions, the variables in a service catalog UI policy condition must be visible (even if hidden by UI policy or read-only) on the form for the condition to be tested. Also, ensure that the variables have names.
-Client-side scripts can add dynamic effects and validation to forms. Scripts can apply to service catalog items or variable sets, allowing administrators to use the same functionality that is available on other forms.
You can use client side scripts to:
- Get or set variable values.
- Hide or display variables.
- Make variables mandatory or not.
- Validate form submission.
- Add something to the cart.
- Order something immediately.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2019 05:35 AM
Hi,
UI policies-
UI policies is used to set field ‘mandatory’, ‘read only’ or ‘visible’ based on the condition.
UI policies stored in [sys_ui_policy] table.
UI policy runs onLoad and onChanage based on condition.
Example-
1. If preferred_mode _of_communication is seleted to mobile then mobile phone field set to mandatory.
2. If prefered_mode_of_communication is selected email then Email field is set to mandatory
Client script-
Client script is a client side code which is used in Servicenow to do some client side validation.
- onCellEdit- run when edit the field in list view
- onChange- run when changed in field on form
- onLoad- run when form loads
- onSubmit- run before form submit
Client script stored in [sys_script_client] table.
Example-
On change the value of Assigned to be copied to short description.
If answer helped you in any way, please then mark it as helpful.
Regards,
Sagar Pagar
www.dxsherpa.com