logo

NJP

Difference between Data policy and UI policy

Import · Jun 24, 2022 · article

The Data Policy and UI policy both implement data regularity by putting the filed attributes on the basis of certain conditions. Data policy gets executed in server- side and UI policy gets executed on client side. DATA POLICY implements data regularity by keeping as mandatory or read only field attributes. The UI policy logic gets applied to data entered in the form whereas the data policy logic gets executed no matter how a record changes. Scripts cannot be applied to Data policy.

Creating a data policy:

Step1: Go to the Create application file link

Step 2: Choose file type, for this case use DATA POLICY

Step 3: Configure the newly created file

Data policy gets triggered on the basis of conditions and they can take different actions as the conditions evaluates to true or false also we don’t need any script code to set the fields as mandatory or read only. Data policies largely similar to UI policies, but the UI policies gets applied to data that is entered inside the form through any browser. Whereas the data policy can be applied to any kind of data entered in the ServiceNow system, including the data that is being imported from the foreign sources like through import sets, web services etc.

We can convert Data Policy into UI Policy and vice versa. ON the UI policy form we can find a UI action button called convert this to the Data policy. Clicking this button will automatically generate a new data policy and will automatically take you to the form that will be displaying the new record, and from data policy to UI policy we will have to navigate to System Policy à Rulesà Data Policies, and then click the existing Data Policy, under the Related Links we will find a Convert this to UI Policy by clicking that a new UI policy record will appear, after that we need to edit the fields in it as we need them.

UI policies are client side functions that work on form and behaviour of form fields in UI policies we do not always need scripting.

UI Polices are used to make form field mandatory, visible and read only.

View original source

https://www.servicenow.com/community/now-platform-articles/difference-between-data-policy-and-ui-policy/ta-p/2313599