Auto populate the value in one variable based on the selection of value in another variable in same variable set

SURAJ3
Giga Contributor

Hi Team , 

 

i have   two variables created in the same variable set in catalogue item 

1.u_ou_name : it has text and values under its question choice tab.

2.u_ou : this needs to auto populated with value same that of value in ou_name, when particular text is selected in ou_name variable.

find_real_file.png

 

find_real_file.png

 

any solution for this 

3 REPLIES 3

Swapnil Shirsik
Giga Guru

Hi, did you try with onChange client script?
example- we can get the user's manager name through getReference function on the onChange client script as below-

 

var name = g_form.getReference('username', callback);
function callback(name) {
g_form.setValue('useremail',name.manager_name);

//Similarly you can try with the other relevant fields as per your requirement.

}

 

Please mark helpful/correct if this information has added value to you.

Community Alums
Not applicable

SURAJ3
Giga Contributor

HI @Swapnil Shirsikar / @Sandeep Dutta ,

 

tried with below script , but no luck ...any correction.

=================================================

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}

var org = g_form.getReference('u_ou_name', callBackMethod);

}

function callBackMethod(org) {

g_form.setValue('u_ou', org.u_ou_name.Text);

}