I need to show values on reference field based on other field selection.

Nandini DM
Tera Contributor

Hi,

I need to show values on reference field based on other field selection.
example: if field 1 selection is "other" , field 2 should show values excluding few options

My script below:

u_getGroupRefQual: function() {
        var filter = '';
        var a = gs.getProperty('populate.group.based.on.type.a');
        var b = gs.getProperty('populate.group.based.on.type.b');
  //if field 1 is selected as option "a"
        if (current.variables.xxx.getDisplayValue() == 'a') {
            filter = 'active=true^type=' + a;
        }   //if field 1 is selected as option "b"
       else if (current.variables.xxx.getDisplayValue() == 'b') {
            filter = 'active=true^type=' + b;
        }   //if field 1 is selected as option "other"
       else if (current.variables.xxx.getDisplayValue() == 'other') {
            filter = 'active=true^type=' + (it should show the values excluding a and b options)
        }
        return filter;
    },
 
Please Help!
6 REPLIES 6

Nandini DM
Tera Contributor

@Community Alums Not working

Community Alums
Not applicable

Hi @Nandini DM ,

Can you please check what's the value coming in current.variables.xxx.getDisplayValue() and try to log it once and tell me what's coming in current.variables.xxx.getDisplayValue().

 

When I tried it in my PDI it works may be you can check the below image once 

SarthakKashya2_0-1713779637598.png

It is executing the else part bcoz a and b is empty.

 

 

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

 

Thanks and Regards 

Sarthak