Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Set value in a single line text variable in a multi row variable set based on producer variable

Amrutha K V
Tera Contributor

How can we set value in a single line text variable which is present in the multi row variable set, based on one of the reference variable [which is present in the record producer]. 

Name of the reference variable which is present in the record producer : Sales Org 
Name of the Single Line Text variable which is present in the multi row variable set : Sales Organization 

When user selects a value in the reference variable : 'Sales Org' from record producer and selects 'Add' on the multi row variable set ->New row opens
Which is having a single line text variable named 'Sales Organization '. 
I wants to autofill MRVS 'Sales Organization' field based on the selected value in Sales Org (outside MRVS).
Could you please help me here.

2 REPLIES 2

Amrutha K V
Tera Contributor

I tried with an OnLoad Client Script in the MRVS level . But this is not working. Please help.

function onLoad() {
    var display = parentForm.getDisplayValue('sales_org');
    g_form.setValue('sales_organization', display);
}

Tanushree Maiti
Tera Sage

Hi @Amrutha K V 

 

You can use an onLoad Catalog Client Script that applies to the MRVS instead. 

Within this script, you can reference variable values on the parent form using g_service_catalog.parent.getValue('var_name').

Refer: https://developer.servicenow.com/dev.do#!/reference/api/rome/client/g_service_catalogClientAPI#g_ser... 

 

sample code:

var display = g_service_catalog.parent.getValue('sales_org');
    g_form.setValue('sales_organization', display);

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: