How to retrieve Multi-Row (MRVS) values and include them in the RITM or Approval Description
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi Everyone,
I have a requirement to include the values from a Multi-Row Variable Set (MRVS) in either the RITM Description (sc_req_item.description) or the Approval Description (sysapproval_approver.description) when a catalog item is submitted.
I know that normal catalog variables can be accessed using current.variables.<variable_name>, but I'm not sure what the best approach is for MRVS.
My questions
- Has anyone implemented this requirement for populating the RITM description or the approval description with MRVS values?
- If possible, could you share your thought
Any guidance or examples would be greatly appreciated.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
data for MRVS is JSON object
So you will have to parse the JSON object and iterate each row and then get the value and set it
check below links with sample code
Populate MRVS Values in RITM Description
also check below links which talks about grabbing MRVS and showing in email, enhance it for your requirement
How to Display Multi Row Variable set (MRVS) data in a notification
also check this
Multi-row variable set in Notifications via Notifications Email Script
Multi-Row Variable Sets: Composing approval and task descriptions
💡 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
yesterday
Hi @TEJAS
Refer:Multi-Row Variable Sets: Composing approval and task descriptions
You can try this:
You can create an After-Insert Business Rule on the Request Item table (sc_req_item) to parse the JSON rows and update the description field
- Table: sc_req_item
- When to run: After, Insert
- Condition: current.variables.YOUR_MRVS_INTERNAL_NAME != ''
(function executeRule(current, previous /*null when async*/) {
var mrvs = 'YOUR_MRVS_INTERNAL_NAME'; // Replace with your MRVS actual internal name
var mrvsValues = current.variables[mrvs];
if (!mrvsValues) return;
var rows = JSON.parse(mrvsValues);
var description = '';
for (var i = 0; i < rows.length; i++) {
description += '--- Row ' + (i + 1) + ' ---\n';
for (var key in rows[i]) {
var varSysId = key;
var gr= new GlideRecord('item_option_new');
if (gr.get(varSysId)) {
var label = gr.question_text;
description += label + ': ' + rows[i][key] + '\n';
}
}
description += '\n';
}
current.description = description;
current.setWorkflow(false);
current.update();
})(current, previous);
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti