Does anyone use data policies to make all variables read only?

AndyNow
Tera Contributor

I am currently using UI Policies to make variables read only but I've since noticed that you can select 'variables' on the data policy module. I have created a data policy on [sc_req_item] and set 'variables' to read only but it hasn't worked. I created a data policy to set the 'Number' attribute to read only and that worked. 

I've also noticed on the data policy a related link 'Convert this to UI policy'. It's got me thinking, is UI policy ServiceNow's preferred method? Has there been a shift over the years to use UI policies instead? Or possibly is there another reason why this isn't working?

find_real_file.png

1 ACCEPTED SOLUTION

Sumit Godse
Giga Expert

Purpose of data policy is to validate the database level updates whereas UI policy mainly executes on a browser at client side. Both are still relevant BUT they serve different usecases.

In the field that you have made readonly via data policy, try to update it using background script and see for yourself if you are able to update it. You wont see that made readonly on UI via data policy though.

Go with UI Policy if you want the field/variable to be readonly/mandatory on UI at client side.

View solution in original post

2 REPLIES 2

Sumit Godse
Giga Expert

Purpose of data policy is to validate the database level updates whereas UI policy mainly executes on a browser at client side. Both are still relevant BUT they serve different usecases.

In the field that you have made readonly via data policy, try to update it using background script and see for yourself if you are able to update it. You wont see that made readonly on UI via data policy though.

Go with UI Policy if you want the field/variable to be readonly/mandatory on UI at client side.

Thank you, 100% correct. I tried to update those fields and it denied me as below. Looks like UI Policy has a better experience in this case.

find_real_file.png