Copy data of 1 field to other field inside MRVS

Suraj_18_18
Tera Contributor

In MRVS,

 

when user submit catalog item, i want to copy data from one field other for each row.

 

below script is not working

 

function onSubmit() {
//Type appropriate comment here, and begin script below
var count = 0;
var mrvsData = g_form.getValue("abcd"); //replace with mrvs internal name
var updatedRows = [];
var mrvsDatastr = JSON.parse(mrvsData);
for (var i = 0; i < mrvsDatastr.length; i++) {
 
 
var amtValue = parseInt(mrvsDatastr[i].amt);
 

// Copy amt to final
mrvsDatastr[i].deard = amtValue;

updatedRows.push(mrvsDatastr[i]);
}
}
 
From amount to final

Suraj_18_18_0-1755619671247.png

 

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@Suraj_18_18 

sorry requirement is not clear.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Suraj_18_18
Tera Contributor

@Ankur Bawiskar 
jus i have to copy one row to other row with onsubmit catalog client script

@Suraj_18_18 

Is this a business requirement?

what's the point of having same data 2 times in 2 rows?

if this is for learning then you can use workflow run script or after insert business rule on sc_req_item table to copy the row.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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