How to create records in a table from MRVS?

Apurv Kumar
Tera Expert

I Want to populate my mrvs data from record producer to a table under a related list of a record form.

I have created a custom table in which similar fields are created as i have in the mrvs + record reference field + mrvs name reference field

In the producer side i have used this code to initialize the record on the table mentioned:

 

(function() {

var mrvs = producer.business_function;

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

var businessFunction = new GlideRecord('incident_task');
businessFunction.initialize();
businessFunction.setValue('af_opportunity', current.getUniqueValue());
businessFunction.setValue('business_function', cells[0].getDisplayValue());   //field type select box
businessFunction.setValue('add_info', cells[1]);

businessFunction.setValue('product_services', cells[1].getDisplayValue());  //field type select box
businessFunction.insert();
}

})();

 

Kindly help me to achieve this..

Thank You

1 ACCEPTED SOLUTION

Hello,

 

Thanks for your help...This code worked well when i parsed the MRVS rows into JSON and then after initializing the record, removed the setValue and replaced with:

businessFunction.business_function = mrvs[i].business_function;

businessFunction.add_info = mrvs[i].add_info;..............and so on

 

View solution in original post

6 REPLIES 6

Hello,

 

Thanks for your help...This code worked well when i parsed the MRVS rows into JSON and then after initializing the record, removed the setValue and replaced with:

businessFunction.business_function = mrvs[i].business_function;

businessFunction.add_info = mrvs[i].add_info;..............and so on

 

@Apurv Kumar  You're welcome ,Please mark it as correct solution so others can find this in future easily.

Thanks