Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Issue with Appending MRVS variables to Record Description

kanvapuriga
Tera Contributor

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.

3 REPLIES 3

sizzleMcFace
Tera Guru

This happens because MRVS data isn’t directly accessible through producer.variable_name in the Record Producer script, it’s stored as JSON. 

 

 

 

You don't need a Business Rule for this, running your script in the Record Producer ensures the description is updated before the record is finalized. 

 

 

 

For detailes, see : Scripting the Multi-row Variable Set from Brad Tilton

Ankur Bawiskar
Tera Patron
Tera Patron

@kanvapuriga 

this should be possible within record producer script itself

sample script

Refer this

Creating records or a summary from Multi-Row Variable Set (2) 

var description = [];
var mrvs = producer.variableSetName; // give mrvs variable set name here

var l = mrvs.getRowCount();
for (var i = 0; i < l; i++) {
    var row = mrvs.getRow(i);
    var cells = row.getCells();

    var m = cells.length;
    for (var j = 0; j < m; j++) {
        description.push(cells[j].getLabel() + ': ' + cells[j].getCellDisplayValue());
    }

    if (i < l) {
        description.push('');
    }
}

current.description = description.join('\n');

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@kanvapuriga 

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! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader