Issue with Appending MRVS Data to Record Description
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi All,
I have created a Record Producer that includes a Multi-Row Variable Set (MRVS). My objective is to automatically append the values from the MRVS to the record's description field upon submission of a request.
I attempted to achieve this using an "After Insert" Business Rule; and also from Reocrd producer script section-->however, the variables within the MRVS are not being appended as expected.
Could anyone please guide me on how to implement this functionality effectively?
Thank you in advance for your support.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Could you share the code you've written for your record producer script? That way, we can review and provide advice on what might be the issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago - last edited 4 weeks ago
Hi @kanvapuriga,
You can achieve this by using a Record Producer Script that retrieves the rows from your Multi-Row Variable Set (MRVS), iterates through each row, and then appends those values to the description field of the generated record (e.g., an incident or a sc_request).
var mrvsName = "mobile_devices_set"; // Replace with your MRVS variable set name
var mrvsVariables = { // Map display labels to MRVS field names
"Device Type": "device_type",
"Storage": "storage",
"Color": "color",
"Quantity": "quantity"
};
var mrvs = JSON.parse(producer[mrvsName]);
var mrvsDetails = generateMrvsDetails(mrvs, mrvsVariables);
current.description = (current.description || '') + '\n--- Mobile Devices ---\n' + mrvsDetails;
// Function to generate MRVS details string
function generateMrvsDetails(mrvsArray, variablesMapping) {
if (!mrvsArray || mrvsArray.length === 0) {
return '\n(No entries provided in the MRVS)\n';
}
var details = '';
for (var i = 0; i < mrvsArray.length; i++) {
var row = mrvsArray[i];
details += '\n--- Entry ' + (i + 1) + ' ---\n';
for (var label in variablesMapping) {
var fieldName = variablesMapping[label];
details += label + ': ' + (row[fieldName] || '') + '\n';
}
}
return details;
}You can also move generateMrvsDetails function to a separate script include if you want to use this in multiple record producers.
If my response helped, please mark it as the accepted solution so others can benefit as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
this is a duplicate thread.
I already shared solution/approach in your other thread.
Issue with Appending MRVS variables to Record Description
💡 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
