On Select Reference field variable & populate select box variable

Km Sh
Tera Contributor

Hello Team,

 

We have Reference variable in a Catalog form, when reference value is selected then auto populate the select box variable with the corresponding pairs as shown below:-

Reference VarSelect box Var
AS1041APAC
AS1039APAC
AS1149EMEA
AS1057EMEA
BS1054Canada
BS1725Canada
BS1578Canada

 

Thanks

5 REPLIES 5

Community Alums
Not applicable

Hi @Km Sh .

I tried your problem in my PDI and it works for me. Currently I'm doing the reference from sys_user table you can change table as per your requirment.

Please check below 

When I select user it changes the drop down value 

1. 

 SarthakKashya2_0-1713358974615.png

 

2. 

SarthakKashya2_1-1713359008772.png

 

I created OnChange Client Script on reference field for my case it's user and added this code, Please refer this code 

SarthakKashya2_2-1713359091270.png

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

    //Type appropriate comment here, and begin script below
    alert('Inside AutoSelectValue = ' + newValue);
    if (newValue == 'be05e21b937331100d5170918bba10c7') { // Give Sys_id of your reference field
        g_form.setValue('select_value', 'Canada');
    }if (newValue == '1832fbe1d701120035ae23c7ce610369') {// Give Sys_id of your reference field
        g_form.setValue('select_value', 'EMEA');
    }if (newValue == '62526fa1d701120035ae23c7ce6103c6') {// Give Sys_id of your reference field
        g_form.setValue('select_value', 'APAC');
    }

}

 

Please mark my answer correct and helpful if this works for you

 

Thanks and Regards 

Sarthak

 

 

@Community Alums 
Thanks for the response.
hmm using Sys_id may not be right approach as its a reference variable & may have a huge list. So using array or alternate option would be better as I understand. 
Appreciate your inputs/suggestions. 
Thanks

Community Alums
Not applicable

Hi @Km Sh ,

If you want to use for only 3reference values you can use sys_id, or if you have many values dependent on you can share me details . The reasone we need to use sys_id because our dependant value type is reference so it will give us sys_id only.

Please mark my answer correct and helpful if this works for you

 

Thanks and Regards 

Sarthak

Hi @Community Alums 

 

I have approx. 850 reference values(custom table) based on that we need to populate select box variable values as mentioned in the list.
Thanks