How to do Map to field on MRVS

Saridha_L1
Tera Expert

Hi Team,

Can anyone please help , How to do Map to  field on  MRVS ,there is no direct option, is there anyway to achieve.

Regards,

Saridha.L.

1 ACCEPTED SOLUTION

try with below code , i have added log as well. so check the log if it does not work, and let me know the log result as well

 

 


var mrvs = JSON.parse(producer.journal_entry_line_items);

var rowCount = mrvs.length;

gs.log('Length is '+ rowCount);

for (var i = 0; i < rowCount; i++) {
var gr = new GlideRecord('x_journal_entr_journal_entry');
gr.initialize();
gr.setValue('u_account', row.u_account);
gr.setValue('u_cost_center', row.u_cost_center);
gr.insert();
}

View solution in original post

31 REPLIES 31

kushal Tayade
Mega Guru

It should be like this:

 

 

var mrvs = JSON.parse(producer.journal_entry_line_items);

for (var i = 0; i < mrvs.length ; i++) {
var gr = new GlideRecord('x_journal_entr_journal_entry');
gr.initialize();

gr.setValue('u_account', mrvs[i].u_account);
gr.setValue('u_cost_center', mrvs[i].u_cost_center);
gr.insert();
}

David Neustadt1
Tera Contributor

Having this same issue:

 

I have a MRVS on a record producer that I want the values added to map to the description field on the resulting HR case record. Below is an example of my MRVS with the fields that values are entered for. 

The 2 variables in my MRVS are 'state' and 'allocation_percentage'

I tried using this UI Policy OnCondition script on the record producer but it did not work

function onCondition() {
var varName = JSON.parse(producer.state_withholding_elections);
var description = '';
for (var i = 0; i < varName.length; i++) {
description += "\n state: " + varName[i].state + "\n allocation_percentage: " + varName[i].allocation_percentage + "\n";
}
current.case_field = description;

}