RITM variables briefly appear and then disappear after page load
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
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);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @muskaanchan
Replace this part
if (isLoading) {
return;
}
To this one
if (isLoading && !newValue) {
return;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
ok ok… See if this solution help you
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB2469045
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0719961
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
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);
}
}
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti