How to make MRVS read only at SCTASK

zee15
Tera Contributor

Hi, I’m facing an issue where I need to make an MRVS (Multi-Row Variable Set) read-only in an SCTASK form.

zee15_1-1781596775609.png

 


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:

zee15_0-1781596407739.png

 


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.

1 ACCEPTED SOLUTION

Tanushree Maiti
Tera Patron

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);

 

}

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

View solution in original post

2 REPLIES 2

Tanushree Maiti
Tera Patron

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);

 

}

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

Thankyou @Tanushree Maiti It work.