The Now Platform® Washington DC release is live. Watch now!

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

what is the difference b/w Ui policy and client script ?

shivaram343
Kilo Contributor

Hi guys,

Please Tell me the difference b/w Ui policy and client scripts ? 

3 REPLIES 3

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Shiva,

 

Please refer.

https://community.servicenow.com/community?id=community_question&sys_id=53b70be9db1cdbc01dcaf3231f961916

 

Thanks,

Pradeep Sharma

Ricardo Velez
ServiceNow Employee
ServiceNow Employee

Hello Shivaram,

 

UI policies offer an alternative to client scripts for dynamically changing information on a form without having to write any code.

The Primary functionality of a UI Policy is the following:

 

  • Conditionally set field to Read-Only / Not Read-Only
  • Conditionally set Field to Visible / Invisible
  • Conditionally set Field to Mandatory / Not Mandatory

 - Scripts can be applied based on if a condition evaluates to true / false.

- Can be run on Desktop / Mobile or both.

 

A client side script similar to a UI policy can also set fields to read-only, mandatory or visible / not visible, however client side javascript coding is required in order to achieve the same actions. With a client side script and the global g_form object, you can achieve goals such as:

1) Display Settings

IE: Hide / Show Fields

2) Field Information

IE: Get field value, get field element
3) Change Field

IE: Set the field to Mandatory or Read-only
4) Change Choice List

IE: Add or remove choices from a choice type field
Form Information

IE: Get form section names, or elements
5) Form Action

IE: Saving or submitting records, display error or info messages

Hope this clarifies things a bit!

 

Best regards,
Ricardo Velez | Senior Technical Support Engineer
ServiceNow | The Enterprise Cloud Company

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi Shiva,

 

Ui Policy:

They are used to make Fields mandatory, visible and readonly depending upon some conditions specified. Here you have reverse if false checkbox where if condition is not met then UI Policy actions will not apply. 

 

Client script:

If you want to make some field mandatory and Readonly or visible based on some complex dynamic logic then we use Client script.

 

In Old days we use to order UI policy, but now we have option to order client script as well.

 

 

https://community.servicenow.com/community?id=community_question&sys_id=a5fb4325db9cdbc01dcaf3231f96198a

https://community.servicenow.com/community?id=community_question&sys_id=092a0f69db5cdbc01dcaf3231f961960

https://developer.servicenow.com/app.do#!/training/article/app_store_learnv2_scripting_jakarta_client_side_scripting/app_store_learnv2_scripting_jakarta_client_scripts_vs_ui_policies?v=jakarta


Thanks,

Ashutosh Munot