We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

how to fetch values from mvrs for variables outside from mrvs in servicenow

sariksorte
Tera Contributor
 
2 REPLIES 2

GopikaP
Mega Sage

Hi @sariksorte , In your client script - 

var mrvs = JSON.parse(g_form.getValue('mrvs')); //name of your mrvs 
    var rows = mrvs.length; 
    if (rows > 0) { 
        for (var i = 0; i < mrvs.length; i++) { 
               g_form.addInfoMessage(mrvs[i].user); //user is the variable inside mrvs
               g_form.addInfoMessage(mrvs[i].req_for); //req_for is the variable inside mrvs
            } 
        } 

GopikaP
Mega Sage

Hi @sariksorte, If it's the other way around, in your client script of MRVS -

var req_for = g_service_catalog.parent.getValue("req_for"); //'req_for' is the variable outside MRVS 
 g_form.addInfoMessage(req_for);