passing a variable from MRVS to main form catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
8 hours ago
I have a Multi Row Variable Set (MRVS) that includes a variable named location (type: Select Box) with the following choices:
- Fourth Floor
- Fifth Floor
- Seventh Floor
- Tenth Floor
Outside the MRVS, I have a variable named standards_access.
I want standards_access to be visible only when any row in the MRVS has location set to "Fourth Floor" or "Seventh Floor".
I previously used a checkbox variable (flag) to set a value to true, and based on that, made standards_access visible. This approach works in the standard UI, but not in Service Portal.
script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
8 hours ago
if (newValue === "Executive Suite" && parent.g_form) in this step I used the selected variables inside the location field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
8 hours ago
try this
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
try {
if (window == null) {
// portal
if (newValue === "Executive Suite" && g_service_catalog.parent.getValue('flag')) {
g_form.addInfoMessage(g_service_catalog.parent.getValue("flag"));
g_service_catalog.parent.setValue('flag', true);
g_form.setVisible('standards_access', true);
}
}
} catch (ex) {
// native
if (newValue === "Executive Suite" && parent.g_form) {
g_form.addInfoMessage(parent.g_form.getValue("flag"));
parent.g_form.setValue('flag', true);
g_form.setVisible('standards_access', true);
}
}
}
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
7 hours ago
you can see the flag is not becoming true. when I select the executive, it shows me as false.