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.

Populate data of Single select field to multi-row variable

Xhare
Tera Contributor

Hi SN Community,

 

I have this requirement to auto populate what was selected in single select variable to my multi row variable field item.

How to achieved this?

 

I'm using client script below: But its not working.

 

var upgradeOpt = g_form.getValue('upgrade_options);

 

if (upgradeOpt == 'Memory Upgrade') {

g_form.setValue('item', 'Memory Upgrade');

}

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

You can use g_service_catalog to get variables from outside of the MRVS, and you need a closing quote on the variable name:

 

var upgradeOpt = g_service_catalog.parent.getValue('upgrade_options');

The rest of your script should be fine as long as the value of the single select variable (not the text/label of this choice) is exactly 'Memory Upgrade'.

 

 

View solution in original post

1 REPLY 1

Brad Bowman
Kilo Patron
Kilo Patron

You can use g_service_catalog to get variables from outside of the MRVS, and you need a closing quote on the variable name:

 

var upgradeOpt = g_service_catalog.parent.getValue('upgrade_options');

The rest of your script should be fine as long as the value of the single select variable (not the text/label of this choice) is exactly 'Memory Upgrade'.