- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2023 11:52 PM
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 12:21 AM
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.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 12:21 AM
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.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2023 07:38 PM
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.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 12:24 AM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2023 12:28 AM
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/
Regards,
Musab