- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello, is there a way that I can do MVRS dynamically to change depending on the topic selected in a select box in a record producer
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hi @montoyb1,
MRVS can be handled the same way as a simple variable. Catalog UI Policy and/or Catalog Client scripts, depending on the nature of what exactly you want to achieve.
In both there's "Applies to" field, select Variable set and associate with the desired (MR)VS to proceed:
100 % GlideFather experience and 0 % generative AI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hello @montoyb1 ,
You can use the onChange client script for changing mrvs depending on the topic selected in a select box,
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (newValue == 'true') {
var obj = JSON.parse(g_form.getValue('mrvs_1')); //get values from MRVS1
var nObj = []; //blank array
for (var i=0; i < obj.length; i++) { //iterate through obj
var ft = obj[i].field_type;
var name = obj[i].name;
var noo = obj[i].number_of_options;
if (ft == 'check-box' || ft == 'drop-down') { //check the field_type
for (var i2=0; i2 < noo; i2++) { //repeat for the number of options required
nObj.push({
field_name: name //push field_name into an array
});
g_form.setValue('mrvs_2', JSON.stringify(nObj)); //set the values in MRVS2
}
}
}
}
}
If my response helped mark as helpful and accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
if you are saying you want to add/remove rows to/from MRVS based on other variable, then yes it's feasible.
You write client script on your select box variable and then form array of json objects and set that in MRVS
I have shared solution in below link, check that and enhance as per your requirement
How to populate Requestor Details in variables of MRVS?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hope you are doing good.
Did my reply answer your question?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hi @montoyb1,
MRVS can be handled the same way as a simple variable. Catalog UI Policy and/or Catalog Client scripts, depending on the nature of what exactly you want to achieve.
In both there's "Applies to" field, select Variable set and associate with the desired (MR)VS to proceed:
100 % GlideFather experience and 0 % generative AI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hello @montoyb1 ,
You can use the onChange client script for changing mrvs depending on the topic selected in a select box,
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (newValue == 'true') {
var obj = JSON.parse(g_form.getValue('mrvs_1')); //get values from MRVS1
var nObj = []; //blank array
for (var i=0; i < obj.length; i++) { //iterate through obj
var ft = obj[i].field_type;
var name = obj[i].name;
var noo = obj[i].number_of_options;
if (ft == 'check-box' || ft == 'drop-down') { //check the field_type
for (var i2=0; i2 < noo; i2++) { //repeat for the number of options required
nObj.push({
field_name: name //push field_name into an array
});
g_form.setValue('mrvs_2', JSON.stringify(nObj)); //set the values in MRVS2
}
}
}
}
}
If my response helped mark as helpful and accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
if you are saying you want to add/remove rows to/from MRVS based on other variable, then yes it's feasible.
You write client script on your select box variable and then form array of json objects and set that in MRVS
I have shared solution in below link, check that and enhance as per your requirement
How to populate Requestor Details in variables of MRVS?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hope you are doing good.
Did my reply answer your question?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

