Mapping Multirow variable sets in Record producer.

Noor
Giga Contributor

Hi,

I have added a new variable to a variable set which is OOB and newly added variable is not mapped to any variable in table.

I have created a custom field in the form to map but not sure How the mapping can be done for 1 extra field added in the variable set in Record Producer.

I tried before insert BR 

(function executeRule(current, previous /*null when async*/) {

var mrvs = current.variables.test_mvs; // your MRVS variable name here
gs.info("Mrv value"+mrvs);

var arr = [];

var parser = new global.JSON();
var parsedData = parser.decode(mrvs);

for(var i=0;i<parserData.length;i++){

var obj = {};
//obj['Date'] = parsedData[i].date.toString(); // give here the mrvs variable name of date
obj['User Details'] = parsedData[i].user_details; // give here the mrvs variable name of user
arr.push(obj);

}
//current.u_details=JSON.stringify(obj);
current.setValue('u_details', JSON.stringify(obj)); // your Name-Value field name here
})(current, previous);

I see the value in the log but is not getting set in the Details field.

2 REPLIES 2

Brad Bowman
Kilo Patron
Kilo Patron

Add some more logs to see the values you're getting throughout the script.  Does your obj contain a valid name/value pair?  Does the value of arr look correct?  Here's a working example of something similar I've done in a Record Producer script - so it sets the name-value pair field on the record from the contents of a MRVS as the record is being created, just like all of the other fields.

var obj={};
var arr=[];
var mrvs = producer.test_mvs;// your MRVS internal name
var rowCount = mrvs.getRowCount();
for(var i=0;i<rowCount;i++){
	var row = mrvs.getRow(i);
	obj['User Details'] = row.user_details.toString();//your details MRVS variable name
	arr.push(obj);
}
current.u_details = JSON.stringify(obj);//your Name-Value Pair field name

Hi Brad,

If i am adding two rows data from mvrs then its only displaying one row data into HRC ticket discriotion.

I want to display multiple row data into HRC description field.

 

Regards,

Pasha