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

Vishwa Pandya19
Mega Sage

Hello,

 

Try below filtering for the other option.

filter = 'active=true^type!='+a+'^ORtype!='+b

If my answer helped you in any way please mark it as correct or helpful.

@Vishwa Pandya19 No luck

Are you running this in script include?

Community Alums
Not applicable

Hi @Nandini DM ,

 

Can you please check below script this may helps you

 

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!=' + a + '^ORtype!=' + b
        }
        return filter;
    },

 

filter = 'active=true^type!=' + a + '^ORtype!=' + b

Try this filter condition this will work 

 

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

 

Thanks and Regards 

Sarthak