Copying rows from a Multiple Row Variable Set(MRVS) to another MRVS that contains the same variables

Amina El hadad
Tera Contributor

Hello Community,

After submitting the form, I need to copy the selected rows from the first Multiple Row Variable Set (MRVS) to the second MRVS, which contains the same variables.

I tried the onSubmit Catalog Client Script below, and it works perfectly in the Service Portal, but it does not work in the back office.

Any thoughts?

Thank you!

 

The onSubmit Catalog Client Script:

function onSubmit() {
 
    var mrvsstore = [];
    var mrvs1 = g_form.getValue('new_tables');
    var mrvs2 = g_form.getValue('allowed_tables');
 
    if (mrvs2.length > 0) {
        mrvsstore = JSON.parse(mrvs2);
    }
    var mrvs1value=JSON.parse(mrvs1);
 
    for (var i = 0;i < mrvs1value.length;i++) {
    mrvsstore.push({
        "allowed_table": mrvs1value[i].table,
        "technical_name_of_the_allowed_table": mrvs1value[i].technical_name,
        "decided_tier": mrvs1value[i].tier
 
    });
}
        g_form.setValue('allowed_tables', JSON.stringify(mrvsstore));
   
}
2 REPLIES 2

Kieran Anson
Kilo Patron

Is the UI type of your script set to All? Not sure mobile/service portal?

Hi @Kieran Anson ,

I have already set the UI type of the script to "All" but it doesn't work.