RITM variables briefly appear and then disappear after page load

muskaanchan
Tera Contributor

 

I am facing an issue with a Service Catalog Requested Item (RITM) form where variables briefly appear when the form loads and then disappear automatically after a second. I want variables to appear on RITM form. How do I do that? 

I suspect it might be related to my catalog client script . Below is the script being used:

 

 
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}

hideAndResetAll();

if (newValue === "approval_matrix_modification") {
g_form.setDisplay("name_of_approval_matrix", true);
g_form.setMandatory("name_of_approval_matrix", true);
g_form.setDisplay("add", true);
g_form.setDisplay("remove", true);
g_form.setDisplay("details", true);
} else if (newValue === "visibility_modification") {
g_form.setDisplay("name_of_item", true);
g_form.setMandatory("name_of_item", true);
g_form.setDisplay("add_visibility", true);
g_form.setDisplay("remove_visibility", true);
g_form.setDisplay("details_visibility_modification", true);
} else if (newValue === "form_modification") {
g_form.setDisplay("name_of_item_form", true);
g_form.setMandatory("name_of_item_form", true);
g_form.setMandatory("details_form_modification", true);
g_form.setDisplay("details_form_modification", true);
}

function hideAndResetAll() {
g_form.setMandatory("name_of_approval_matrix", false);
g_form.setDisplay("name_of_approval_matrix", false);
g_form.setDisplay("add", false);
g_form.setDisplay("remove", false);
g_form.setDisplay("details", false);

g_form.setMandatory("name_of_item", false);
g_form.setDisplay("name_of_item", false);
g_form.setDisplay("add_visibility", false);
g_form.setDisplay("remove_visibility", false);
g_form.setDisplay("details_visibility_modification", false);

g_form.setMandatory("name_of_item_form", false);
g_form.setDisplay("name_of_item_form", false);
g_form.setMandatory("details_form_modification", false);
g_form.setDisplay("details_form_modification", false);
}
}
 

 

5 REPLIES 5

Rafael Batistot
Kilo Patron

Hi @muskaanchan 

 

Replace this part

 

if (isLoading) {
return;
}

 

To this one 

 

if (isLoading && !newValue) {
return;
}

If this response was helpful, please mark it as Helpful and, if applicable, as Correct, this helps other users find accurate and useful information more easily.

Hi @Rafael Batistot ,
This doesn't work. The variables are visible on the service catalog portal but not on the ritm form in the variables section.

@muskaanchan 

 

ok ok… See if this solution help you 

 

https://www.servicenow.com/community/sysadmin-forum/service-catalog-variables-not-showing-on-the-rit...

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB2469045

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0719961

 

If this response was helpful, please mark it as Helpful and, if applicable, as Correct, this helps other users find accurate and useful information more easily.

Tanushree Maiti
Tera Patron

Hi @muskaanchan 

 

Try this one:

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}

hideAndResetAll();

if (newValue == 'approval_matrix_modification') {
g_form.setDisplay("name_of_approval_matrix", true);
g_form.setMandatory("name_of_approval_matrix", true);
g_form.setDisplay("add", true);
g_form.setDisplay("remove", true);
g_form.setDisplay("details", true);
} else if (newValue == 'visibility_modification') {
g_form.setDisplay("name_of_item", true);
g_form.setMandatory("name_of_item", true);
g_form.setDisplay("add_visibility", true);
g_form.setDisplay("remove_visibility", true);
g_form.setDisplay("details_visibility_modification", true);
} else if (newValue == 'form_modification') {
g_form.setDisplay("name_of_item_form", true);
g_form.setMandatory("name_of_item_form", true);
g_form.setMandatory("details_form_modification", true);
g_form.setDisplay("details_form_modification", true);
}

function hideAndResetAll() {
g_form.setMandatory("name_of_approval_matrix", false);
g_form.setDisplay("name_of_approval_matrix", false);
g_form.setDisplay("add", false);
g_form.setDisplay("remove", false);
g_form.setDisplay("details", false);

g_form.setMandatory("name_of_item", false);
g_form.setDisplay("name_of_item", false);
g_form.setDisplay("add_visibility", false);
g_form.setDisplay("remove_visibility", false);
g_form.setDisplay("details_visibility_modification", false);

g_form.setMandatory("name_of_item_form", false);
g_form.setDisplay("name_of_item_form", false);
g_form.setMandatory("details_form_modification", false);
g_form.setDisplay("details_form_modification", false);
}
}
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