how to access MVRS variables outside mvrs for to autopopulate catalog item variables

sariksorte
Tera Contributor

how to access MVRS variables outside mvrs for to autopopulate catalog item variables

1 ACCEPTED SOLUTION

Hi @sariksorte Please try this - 

//Type appropriate comment here, and begin script below
    var obj = JSON.parse(g_form.getValue('application_namespace_configuration'));
    alert(obj);
    for (var i = 0; i < obj.length; i++) {
        g_form.addInfoMessage(obj[i].app_nickname); //user is the variable inside mrvs
		obj[i].app_nickname = "HI";
    }
	g_form.setValue('application_namespace_configuration', JSON.stringify(obj));

For me this script is working and setting the variables values inside the MRVS. Please let me know at which point in the script it is not functioning as expected?

View solution in original post

12 REPLIES 12

This script is not alerting 'obj' or the info message is not coming as expected? 

var obj =JSON.parse( g_form.getValue('application_namespace_configuration'));
 alert(obj);
   for (var i = 0; i < obj.length; i++) {
               g_form.addInfoMessage(obj[i].app_nickname); //user is the variable inside mrvs
             
            }

Also, can you share the variables list in catalog item and variable set variables, so that I will try to reproduce it in my pdi.

sariksorte
Tera Contributor

sariksorte_0-1741591706613.png

sariksorte_1-1741591783146.png

landscape is the variable in catalog item

 

sariksorte_2-1741591864573.png

 

Hi @sariksorte Please try this - 

//Type appropriate comment here, and begin script below
    var obj = JSON.parse(g_form.getValue('application_namespace_configuration'));
    alert(obj);
    for (var i = 0; i < obj.length; i++) {
        g_form.addInfoMessage(obj[i].app_nickname); //user is the variable inside mrvs
		obj[i].app_nickname = "HI";
    }
	g_form.setValue('application_namespace_configuration', JSON.stringify(obj));

For me this script is working and setting the variables values inside the MRVS. Please let me know at which point in the script it is not functioning as expected?

Hi Gopika,

Thank you for your quick response, it helped

PraveenK1149237
Tera Expert

Could you please let me know is the onChnage on the mrvs or other variable if it is on other variable what will you want after accessing MRVS?