Make Variable Editor Readonly only for few variables.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2025 11:04 AM
I have a Record producer, in that i created some fields in it. To show all fields on my custom tables i have created a Variable editor. Now i can see all the fields on my table. and to make all the fields Readonly i have used below code. But it's making all the fields Readonly, I want some of the fields editable. How can i achieve this?
Can anyone help me on this please ??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2025 11:03 PM
Hi @Shubham_90 ,
Why are you using a variable editor and not making fields per question from the form into the custom record as intended ? That way you can use ACL's/UI Policy/views to make field read only and have a beter control over them.
If this is your only way try the code: g_form.setReadOnly(variableName, true);
See these articles for more assistance:
GlideForm - Client
setVariablesReadOnly method is not working on Variable Editor on Incident table - Support and Troubl...
Kind Regards,
Collin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2025 11:09 PM
simply make the other variables editable explicitly after that line
function onLoad() {
g_form.setVariablesReadOnly(true);
g_form.setReadonly('variable1', false);
g_form.setReadonly('variable2', false);
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader