ITSM Catalog item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi All,
I want to populate the variable's value which is inside the MRVS onto the onsubmit catalog client script , however i am not able to access the mrvs value from the onsubmit client script which applies to the catalog item.please help me on this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0743684
Regards
Dr Atul G. - Learn N Grow Together ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
******************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
you can grab the MRVS value in onSubmit catalog client script which Applies to Catalog Item and it gives you the JSON object
You can iterate over that and then grab the value
function onSubmit() {
var mrvsValue = g_form.getValue('mrvsVariableSetName'); // give your MRVS variable set name here
for (var i = 0; i < mrvsValue.length; i++) {
var val = mrvsValue[i].userVariableName; // give here the variable name within MRVS
alert(val);
}
}
💡 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 || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Just following up to see whether my suggested solution worked for you.
If you're still facing any issues, I'd be happy to help further.
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
You can't directly access individual MRVS variable values from the parent catalog item's onSubmit Catalog Client Script.
Instead, retrieve the MRVS as JSON using g_form.getValue('<mrvs_variable_name>') and parse it.
var mrvs = JSON.parse(g_form.getValue('your_mrvs_name')); for (var i = 0; i < mrvs.length; i++) { console.log(mrvs[i].your_variable_name); }
If g_form.getValue() returns an empty value, please confirm whether you're using the Service Portal or the Native UI, as MRVS behavior differs slightly between them.