- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday - last edited yesterday
Hi, I’m facing an issue where I need to make an MRVS (Multi-Row Variable Set) read-only in an SCTASK form.
My requirement is that all variables should be read-only at the SCTASK level. To achieve this, I created an onLoad client script and used the following code:
g_form.setVariablesReadOnly(true);However, this did not work.
I also tried making specific variables set as read only using:
g_form.setReadOnly('internal_end_of_life_data', true);
g_form.setReadOnly('publisher_end_of_life_data', true);Additionally, I attempted:
g_form.setReadOnly('variables.publisher_end_of_life_data', true);But none of these approaches worked. but same code "g_form.setVariablesReadOnly(true);" is working at RITM. See the attached image below:
Could someone please help me understand what I might be doing wrong or suggest the correct way to make MRVS read-only in this scenario? Any help would be greatly appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @zee15
To make a Multi-Row Variable Set (MRVS) read-only on an SCTASK form, create an onLoad Catalog Client Script. Ensure the script is set to apply on Catalog Tasks, and use the standard g_form.setReadOnly() method targeting the internal name of your MRVS.
Navigator, go to Service Catalog > Catalog Policy > Catalog Client Scripts > click New.
- Name: Give your script a recognizable name
- UI Type: Set to All
- Type: Select onLoad.
- Applies on Catalog Tasks: Check this box
function onLoad() {
g_form.setReadOnly('internal_end_of_life_data', true);
g_form.setReadOnly('publisher_end_of_life_data', true);
}
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @zee15
To make a Multi-Row Variable Set (MRVS) read-only on an SCTASK form, create an onLoad Catalog Client Script. Ensure the script is set to apply on Catalog Tasks, and use the standard g_form.setReadOnly() method targeting the internal name of your MRVS.
Navigator, go to Service Catalog > Catalog Policy > Catalog Client Scripts > click New.
- Name: Give your script a recognizable name
- UI Type: Set to All
- Type: Select onLoad.
- Applies on Catalog Tasks: Check this box
function onLoad() {
g_form.setReadOnly('internal_end_of_life_data', true);
g_form.setReadOnly('publisher_end_of_life_data', true);
}
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Thankyou @Tanushree Maiti It work.