Set value of a field, from a field in a MRVS

Facundo Prado
Tera Expert

Hello everyone!!
I have this field on the Form (Payment reference). with this MRVS (Booking details):

FacundoPrado_0-1709754282673.png

I need to populate in the "payment reference" field, with the value of "total expense" from MRVS.

I´ve tried with a onSubmit client script applied to a Variable set, but is not working.

If you have some idea i´ll appreciate.

Thanks!

 

5 REPLIES 5

Aman Kumar S
Kilo Patron

Hi @Facundo Prado 

You can try below script:

function onSubmit(){
    var mrvs= g_form.getValue('mrvs_variable_name'); // name of your mrvs avriable
    var mrvsParsed= JSON.parse(mrvs);
    var paymentRef= 0;

     for(var i=0; i<mrvsParsed.length; i++){
         paymentRef= paymentRef+ parseFloat(mrvsParsed[i].total_expense); // name of your variable in mrvs
     }
     g_form.setValue('pyament_Refernece', paymentRef); // validate the name of your variable
}
Best Regards
Aman Kumar