Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to set the variable value with the MRVS reference variable data

kumar22
Tera Contributor

Hi Team,

I have a requirement below :

Catalog item variable: MRVS data(mrvs_data)

Multi-Row variable set: Mobile Devices Set (mobile_devices_set)

kumar22_0-1716875705193.png

Once the request gets submitted I need to pass the Approval User (approval_user) data to the MRVS data(mrvs_data) variable. I tried using the OnSubmit client script below but it returned the sys_id instead of User ID.

 

function onSubmit() {
var deviceSet = g_form.getValue("mobile_devices_set");
    var str = JSON.parse(deviceSet);
    var appUserArray = [];
    for (var i = 0; i < str.length; i++) {
        //var num = i + 1;
        appUserArray.push(str[i].approval_user);
    } 
    var approvalUser = appUserArray.join(' , ');
    g_form.setValue("mrvs_data", approvalUser);   
}

Kindly suggest on this? 

Thanks in advance.

11 REPLIES 11

kumar22
Tera Contributor

Hi Team, any suggestions on this thread?

kumar22
Tera Contributor

Hi Team, any suggestions on this?

@Ankur Bawiskar 

Thanks!

@kumar22 

so you want to set MRVS variable based on outside variable?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Once the request is submitted, want to set MRVS variable data into free text variable available outside of MRVS.

kumar22
Tera Contributor

Hi @Ankur Bawiskar - Any advice on this?

Thanks!