How to add a Multi-Row Variable set from a record producer to the target table.

AM24
Giga Guru

Hello, I have a record producer that contains a multi-row variable set. I want the values for this field to be copied over to the record created by the record producer. I was wondering how I can do that. Thanks.

7 REPLIES 7

No I don't want it under description. I want the field to show up in something like variables.

Hi,

can you share some screenshot of the field where the MRVS data needs to filled in ?

RiteshSwarnakar
Giga Guru

In "What it will contain" section of Record Producer:

 

Script:

var count = producer.variable_set_name.getRowCount();
var gr = new GlideRecord('custom_table');

for(var i = 0; i < count; i++) {
gr.initialize();
gr.setValue('table_field1', producer.variable_set_name.getRow(i).variable1);
gr.setValue('table_field2', producer.variable_set_name.getRow(i).variable2);
gr.insert();
}
current.setAbortAction(true);           // to prevent a empty record creation