How to Make a Dictionary-Level Read-Only Field Editable When Empty in ServiceNow?

NikhithaNikki
Tera Contributor

I have field called HTAS ITSLT Owner which read only at dictionary level and used in digital platform table and I want to make this field as editable when it is empty and make read only when value is there.

 

How Should I Do?

 

I have used business rule but its not working.

(function executeRule(current, previous /*null when async*/) {
gs.log("testing3333" + current.getDisplayValue('u_htas_itslt_owner'));
    // Add your code here

        // Remove read-only protection for this field
        current.setReadOnly('u_htas_itslt_owner', false);

        gs.log("testing3333" + current.getDisplayValue('u_htas_itslt_owner'));

})(current, previous);
 
And Ui policies are also not working
1 REPLY 1

J Siva
Tera Sage

Hi @NikhithaNikki 
If a field is marked as 'Read-only' at the dictionary level, it cannot be made editable through scripts. To make the field editable, you need to uncheck the 'Read-only' checkbox in the dictionary record and then configure field-level write ACLs according to your requirements.

Regards,
Siva