Originally from earlduque/ServiceNow-Developer-Training. Thanks Earl!

UI Policies in ServiceNow #

What is a UI Policy?

What does a UI Policy Do?

Create a new UI Policy

UI Policies and Catalog Items

Things to Try

Videos and Related Content

What is a UI Policy? #

A UI policy stands for "user interface policy". A UI policy is a rule that controls the appearance and other characteristics on a field in a form.

What does a UI Policy do? #

The purpose of UI Policies in ServiceNow are to change the behavior of forms and control and customize process flows.

UI Policies can do many things such as, for example:

  • Make specific fields on forms mandatory
  • Dynamically hide or show fields depending on the selection of other fields
  • Make certain fields read only
  • And more

Basic UI Policies don't require the use of scripting, but for more advanced or customized options, use the Run Scripts option.

While client scripts can be used to perform all these actions, for faster loading times UI Policies should be used whenever possible.

Note: ui_policy_admin role is required to make these changes

Create a new UI Policy #

Refer to ServiceNow documentation for more information.

Log in to your personal developer instance.

1. Navigate to System UI > Policies.

2. Click New.

3. To change the view, in Related Links click Default View.

4. Select the table to be affected by the UI Policy.

5. Click submit.

Just a reminder that in order for the UI policy to work as intended:

  • It must be set to an 'Active' state
  • The items in the Conditions field must evaluate to true
  • The field specified in the UI policy action is present on the specified form

Creating a UI Policy on a Catalog Item #

1. To make a UI Policy for a Catalog Item, scroll down to the bottom of the Catalog Item and click **Catalog UI Policies.*

screen shot 2019-01-23 at 2 22 19 pm

2. Click New.

screen shot 2019-01-23 at 2 26 55 pm

3. Make sure that it applies to Catalog Item, not a Variable Set.

4. Provide a short description of what your UI Policy is meant to do.

5. Choose a set a conditions that evaluates to true (form field, filter condition, 'OR' field).

screen shot 2019-01-23 at 3 29 44 pm

6. Make sure to set the appropriate order for the UI Policy (it automatically sets it at 100).

7. Make sure to check/uncheck options that control when the UI Policy is applied: (Applies on Catalog Item View, Applies on Catalog Tasks, Requested Items, On Load, and Reverse if False).

screen shot 2019-01-23 at 3 29 49 pm

8. If further customization is required, click on the Scripts tab next to When to Apply tab, and check the Run Scripts box.

screen shot 2019-01-23 at 3 39 54 pm

9. Make sure to check that the appropriate selection is chosen under the Run Scripts in UI list (generally we select the All option).

10. Enter scripts to execute of UI Policy conditions evaluate to True or False (i.e. setting up an error message when the user attempts to enter an invalid response to a field).

11. Before you submit, be sure that the UI Policy is set to Active.

12. Submit.

Things to try #

  • Requiring certain fields to be mandatory
  • Dynamically hiding/Showing certain fields depending on the selections the user makes
  • Making a field mandatory after a user selects an option

ServiceNow Training Part - 10 (Client Script & UI Policy)

New UI Policy functionality in ServiceNow London Release

Creating UI Policies In ServiceNow

15. ServiceNow UI Policy - Use Cases with Solution

ServiceNow UI Policy Action Tutorial | ServiceNow Tutorial For Beginners | What is AIX ? - ExcelR