ui policy in servicenow

UI policies dynamically change the behavior of information on a form and control custom process flows for tasks.It allows you to change and modify how fields on a form are displayed. Using conditions, you can set your field to be hidden, make them mandatory, or set them to read-only.

What is UI Policy?

    1. UI Policy define the behaviour and visibility of fields on a form
      • Mandatory
      • Visible
      • Read-only
      • Clear the field value.
    2. Condition must be true for it to execute.
    3. Execute after Client Scripts
    4. UI policy condition evaluates all fields even if they are not visible on the form. This function removes the requirement that a field must be on a form for it to be evaluated.
    5. UI policies are not supported on search screens.

Always use a UI Policy instead of a Client Script, if you can, for faster load times and easier maintenance.

How to Create UI Policy?

    1. Navigate to All > System UI > UI Policies.
    2. Click New.
    3. The UI Policy [Advanced view] form opens
    4. To change the view, in Related Links click Default view.
    5. Complete the form, as appropriate.
    6. You may need to configure the form to see all the fields.ui policy in servicenow - servicenowhelpdesk.com

UI Policy Actions

UI Policy Actions are client-side logic in a UI Policy used to set three field attributes:

        • Mandatory
        • Visible
        • Read only
        • Clear the field value

Although you can use scripts to set these attributes using the GlideForm (g_form) API, UI Policy Actions do NOT require scripting to set the field attributes.

We can Use UI Policy Related List Actions to show or hide related lists. 

UI Policy Scripts

Client-side API will be used in UI Policy to execute script logic based on whether the UI Policy condition tests true or false. We can use UI Policy scripts to create complex conditional checks or to take actions other than setting field attributes (mandatory, read-only, or visible).

Script field only be visible in the advanced view. Select the Run scripts option to enable the script field.

      • The field Execute if true script executes when the UI Policy condition tests true.
      • The field Execute if false script executes when the UI Policy condition tests false.
      • ui policy in servicenow - servicenowhelpdesk.com

Real World Scenario

Requirement: Make planned start and end date mandatory if state of change is schedule and hide related list Incident caused by change if state of change move to implement state.

Solution: create an UI policy with below configuration.

      • Create an UI policy on change request table.
      • Put condition state=Scheduled and save the form.
      • Go to related list section UI Policy Action and click on New.
      • Select the required filed in Field Name and select true for Mandatory attribute.
      • Save the record and check the desire output.

 

 

Join Us

Thanks for reading this article, i hope you liked it, if that so, do like and subscribe my YouTube channel. You can also join our telegram channel to clear your technical doubt.

 

 

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here