Make Variables read only on RITM and Task

Mark Wood
Tera Contributor

Hello experts,

 I want to make all variables on the RITM and Catalog task read except one variable,

to make variables read-only I have onload client script :

g_form.setVariablesReadOnly(true);

above code making all variables read-only, I want all variables to be read-only except.

How can I achieve this please guide me on this.

thank you.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Mark Wood 

then handle those explicitly i.e. make them editable after that line

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  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@Mark Wood 

then handle those explicitly i.e. make them editable after that line

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  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Mark Wood 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Anubhav24
Mega Sage
Mega Sage

Hi @Mark Wood ,

You can also use UI Policy to make variables read only and that way you will only need to mark the variables read only and the additional statement of making one variable editable can be avoided.

 

Musab Rasheed
Tera Sage
Tera Sage

Here is the solution

https://www.youtube.com/watch?v=4bnklgcNAAc

https://conyxit.com/servicenow-make-all-the-variables-read-only-in-the-ritm-view/

Please hit like and mark my response as correct if that helps
Regards,
Musab