Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Edit a read only field (value) as Admin

kristianhaahr
Kilo Contributor

Hi, i have a coloumn that is read only. But now i have to change a few values and i'm the serviceNow admin. But how can i do that, without making the fileld non read only and then read only again after i have changed the values. There must be a smarter way

3 REPLIES 3

harishdasari
Tera Guru

Hi Kristian,



Create write ACL for that field and exclude the "Admin" for editing this field.


So only ITIL users it will displayed as "read-only" field and for admins it will be normal editable field.



Thanks


divya mishra
Kilo Sage

Write an OnLoad client script :



if(g_user.hasRole('admin')){


g_form.setReadOnly('fieldname',false);


}



Make the changes and delete the client script.



OR



Write a   write acl and make a condition to make field editable if the role is admin. Once the changes are done, remove the ACL.







post me your feedback



Please Hit ✅Correct, ��Helpful, or ��Like depending on the impact of the response



Have a lovely day ahead




Regards,



Divya Mishra


sushant007
Kilo Guru

you can always use background script> write your script and change the value as per the need.



other way is open the record press alt+crtl+shift+J ; java script executor will pop up ; write the client script to change the value of field and execute; after that save the form.