Autopopulating Multi-Row Variable Set Field Based on Single Row Variable Set

ElimaS
Tera Contributor

 

 

There is a field called 'entity' in a single row variable set on the record producer form that pulls the 'code' from the company table. There is also a 'company_system' field in a multi-row variable set on the same form. I want to automatically populate the 'company_system' field with the 'system' value from the company table based on the selected 'entity'. I can retrieve the correct value in 'answer', but I need help figuring out how to set that value in the 'company_system' field. Can anyone provide guidance on this?

ElimaS_6-1749130106757.png

 

ElimaS_5-1749129611845.png

 

2 REPLIES 2

palanikumar
Mega Sage

You can use the below code:

 

var mrvsData = g_form.getValue("mrvs_internal_name"); // Replace mrvs_internal_name with actual internal name or MRVS
var mrvsDatastr = JSON.parse(mrvsData);
for (var i = 0; i < mrvsDatastr.length; i++) {
    mrvsDatastr[i].company_system = answer; //company_system is the variable name inside MRVS. Update it if not correct
}
g_form.setValue("mrvs_internal_name",JSON.stringify(mrvsDatastr)); // Replace mrvs_internal_name with actual internal name or MRVS
Thank you,
Palani

Thank you for your response. However, it seems it's not working- the value is not getting auto-populated in the field.