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.

Make Variable Editor Readonly only for few variables.

Shubham_90
Tera Contributor

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 ?? 

 

function onLoad() {
   g_form.setVariablesReadOnly(true);
}
2 REPLIES 2

Collin Romeijn
Mega Guru

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

Ankur Bawiskar
Tera Patron

@Shubham_90 

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.

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader