top of page

UI Policy in ServiceNow

With Lorena Villanueva

In this article, we are taking a look at UI policies. We'll explain what UI policies are in relation to your form display, the benefits of UI policies, and go through a quick tutorial on how to create one.

What is UI Policy

UI policy in ServiceNow 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. Before we jump into creating a UI policy, let's go ahead and take a look at our incident form. Suppose you’ve been given a set of requirements that are dependent on our category field being set to software. The first requirement is to set the service field to mandatory, the second is to make the configuration item field read-only, and lastly, we are to hide the contact type field.

Meeting Requirements with a UI Policy

Let's go ahead and take a look at how we can meet those requirements with a UI policy. Looking at our new record form, we'll go ahead and populate the necessary information. This UI policy will be applied to the incident table; we'll go ahead and populate the short description. For when to apply, we’ll go ahead and set the condition where the category is software, and we'll go ahead and leave everything else to their default settings and hit submit.

Making Field Changes

Now that we've applied conditions to our UI policy, the next step is to make those field changes. To do so, we'll create new UI policy actions that can be found in the related list of our UI policy. We'll go ahead and create a new record and set the field name to service. We'll make the mandatory true and submit this record. At a glance, we're looking at a UI policy where the condition category is software, the field change that we want to make is the service field, and we want to make that true. To confirm that this has taken place, we'll go ahead and make a test run.

Making a Test Run

We will test this out by reloading our form. As you can see now that the category is set to software, the service field is now set to mandatory. If you change this field, the service field is no longer set to mandatory. We'll go ahead and make the other field changes by creating new UI policy actions (reference video at 3:05).

Now that we've created our three UI policy actions, which sets those field changes, we'll go ahead and make a test. We've refreshed our incident form, and as we can see, the category is software, our service field is now set to mandatory, our configuration item field is set to read-only, and our contact type field is now hidden. When we change the category field, we see that they've all been reversed back to their original settings, so service is now no longer mandatory, and so on and so forth. We've created our UI policy with the related UI policy actions to make those field changes.

Some may wonder: couldn't we have done this with a client script? Well, we could have, but some of the benefits of using a UI policy in lieu of a client script include the use of the order field, which you can see in the advanced view, it's defaulted to 100. If you have multiple UI policies, the order field will allow you to control the order in which your policies take place. The next benefit is low to no code; if you have simple logic occurring on your form, UI policies allow you that option to build your conditions without having to code. For situations where you need that added flexibility, you are provided the option of run scripts, where you can go ahead and execute different scripts depending on whether they are true or false.

To summarize, in this demo, we went over the benefits of UI policy and when to use them. We also created a UI policy where we built conditions that allowed us to make fields on the incident mandatory, read-only, and make fields hidden. This concludes our UI Policy Demo!

Did you find this UI Policy in ServiceNow article helpful? Are you ready to start your journey with ServiceNow? If you want to find out more information about GlideFast Consulting and our ServiceNow implementation services, you can reach out to us here.


About GlideFast Consulting

GlideFast is a ServiceNow Elite Partner and professional services firm that provides tailored solutions and professional services for ServiceNow implementations, integrations, managed support services, application development, and training. Reach out to our team here.

5,520 views0 comments

Recent Posts

See All
bottom of page