- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2021 01:48 AM
Hi All
Need help on Multi Row Variable Set client side scripting on an Record Producer. I have 2 MRVS.
Based on first MRVS entry another needs to be disabled or hidden.
Any suggestions how to achieve or reference is highly appreciated.
Thank You
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2021 03:55 AM
You need to write an onChange Catalog Client Script within the 1st MRVS, when your particular variable in the variable set changes. So for any row in MRVS1, when a certain value is selected, MRVS2 will become hidden. The script would look like this to hide the 2nd MRVS.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if(newValue == 'My Choice'){//replace with the value that should hide MRVS2
if(this){//Service Portal method
this.cat_g_form.setDisplay('mrvs2', false);//replace with the internal name of 2nd MRVS
}
else{//native UI method
parent.g_form.setDisplay('mrvs2', false);//replace with the internal name of 2nd MRVS
}
}
}
If you are using Service Portal, you will also need an onLoad Catalog Client Script within the Record Producer, not the MRVS.
function onLoad() {
if (this) {//we only need to do this for Service Portal
//We need to make the g_form object for the parent item available from the MRVS window
this.cat_g_form = g_form;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2021 04:46 AM
Hi,
you can get MRVS value using g_form.getValue('firstMRVSVariableName')
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2021 05:02 AM
Hi RAviteja,
you can check these articless where i have given sample script on MRVS.
Mark the comment as a correct answer and helpful if it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2021 03:55 AM
You need to write an onChange Catalog Client Script within the 1st MRVS, when your particular variable in the variable set changes. So for any row in MRVS1, when a certain value is selected, MRVS2 will become hidden. The script would look like this to hide the 2nd MRVS.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if(newValue == 'My Choice'){//replace with the value that should hide MRVS2
if(this){//Service Portal method
this.cat_g_form.setDisplay('mrvs2', false);//replace with the internal name of 2nd MRVS
}
else{//native UI method
parent.g_form.setDisplay('mrvs2', false);//replace with the internal name of 2nd MRVS
}
}
}
If you are using Service Portal, you will also need an onLoad Catalog Client Script within the Record Producer, not the MRVS.
function onLoad() {
if (this) {//we only need to do this for Service Portal
//We need to make the g_form object for the parent item available from the MRVS window
this.cat_g_form = g_form;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2022 08:24 AM
This is extremely useful! Thanks very much for posting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 07:07 AM
This method is way more powerful than the example that is used for, allowing to load other elements outside of portal scope.