Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How a field Dictionary Entry set to Readonly works for UI update versus REST API table update?

chaitanyasaraga
ServiceNow Employee
ServiceNow Employee

I have a table with a date field(closed_at) and a number field ( state).

The dictionary entry of the closed_at filed is set to "Read Only". And a business rule (before insert/update) is written to set the closed_at filed to current date when the state = 7.

Now when the state is set to 7 from UI ( list view or form view) of a record, the closed_at field is getting set to the current date value, but when the same state value is set to 7 via service-now REST api(table API) the BR is getting called but the value of the closed_at field is not getting set.

Only the read-only field is unchecked from the dictionary of closed_at filed and saved, it is working fine in both the ways(UI and REST API).

Why so and what is the reason for this behaviour? Appreciate if someone can help me understand the internal (technical) logic behind this behaviour.

2 REPLIES 2

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Chaitanya,



How to enable read-only of particular column for certain users.


- Easy way is to create ACL on particular field for write, create operations which will avoid modifying field and you can open up that field to API user.



Reference;


Re: User with itil_admin role not able to close incident using rest api call.


PUT Table REST API to update read-only field


Thanks Pradeep. I have looked at the given links but couldn't find the answer to what I'm looking for.


My question is about why the UI transaction makes the BR run and update the closed_at field value but the same is not working when updated using table API.