To display only those name of locations which have specific countries on basis of set of choices

rishabh31
Mega Sage

Dear Experts,

I have total 3 variables, 

Variable #1- Name: company; Type: Multiple Choice(None included), Choices (Value): ABC Org, PQR Org, XYZ Org (Order 100, 200, 300 respectively)

 

Variable #2- Name: job_type; Type: Select Box(None Included), Choices (Value): Dependent, InDependent, Misc (Order 100, 200, 300 respectively)

 

Variable#3- Name: location_name; Type: Lookup Select Box(None Included; Lookup from table: cmn_location; Lookup value field: Name; No reference qualifier set and No value attributes set).

 

Requirement is:

If company-ABC Org and job_type-'InDependent' is selected, then display only those 'location_name' (Name) which having Country-'Canada' and 'USA'

 

If company-XYZ Org and job_type-'InDependent' is selected, then display only those 'location_name' (Name) which having Country-'Italy'

 

If any/either of 3 provided comapny (ABC Org or PQR Org or XYZ Org) and job_type-'Dependent' is selected, then display only those 'location_name' (Name) which having Country-'Australia'

 

 

If any/either of 3 provided comapny (ABC Org or PQR Org or XYZ Org) and job_type-'Misc' is selected, then display only those 'location_name' (Name) which having Country-'Australia', 'Brasil' & 'Japan'

 

Requesting help on how it can be achieved as I referenced some links just to initiate atleast but unable to get this done. Kindly advise the steps on how this can be achieved .

 

Thank you in advance. Will mark your response helpful and accepted solution if response helped me on learning.

 

 

 

 

2 ACCEPTED SOLUTIONS

@rishabh31 , please try to do it via script include

Adv Ref Qual:

javascript: new AdvRefQuery().getQuery(current.variables.company,current.variables.job_type);

 

Script Include:

var AdvRefQuery = Class.create();
AdvRefQuery.prototype = Object.extendsObject(AbstractAjaxProcessor, {

    getQuery: function(company, jobType) {

        if (company == 'ABC Org' && jobType == 'InDependent') {
            return 'country=Canada^ORcountry=USA';
        } else if (company == 'XYZ Org' && jobType == 'InDependent') {
            return 'country=Italy';
        } else if ((company == 'XYZ Org' || company == 'PQR Org' || company == 'ABC Org') && jobType == 'Dependent') {
            return 'country=Australia';
        } else if ((company == 'XYZ Org' || company == 'PQR Org' || company == 'ABC Org') && jobType == 'Misc') {
            return 'country=Australia^ORcountry=Brasil^ORcountry=Japan';
        }
    },
    type: 'AdvRefQuery'
});

 

Hope this helps!

Thanks!

View solution in original post

@rishabh31 , in the variable attributes add this line, it'll work

 

 

 ref_qual_elements=company;job_type

 

 

 

 

View solution in original post

13 REPLIES 13

@rishabh31  - can you please check the backend names (values )of the choices, if they are correct or not.

Yes @Karan Chhabra6, I checked the values of choices and It perfectly matches with your code, pls see screenshots

rishabh31_0-1682766821346.pngrishabh31_1-1682766855621.png

 

@rishabh31 , please try this

javascript: var query; if(current.variables.company == 'ABC Org' && current.variables.job_type == 'InDependent') query = 'country=Canada^ORcountry=USA';
else if(current.variables.company == 'XYZ Org' && current.variables.job_type == 'InDependent')  query = 'country=Italy';
else if((current.variables.company == 'XYZ Org' || current.variables.company == 'PQR Org' ||current.variables.company == 'ABC Org') && current.variables.job_type == 'Dependent') query = 'country=Australia';
else if((current.variables.company == 'XYZ Org' || current.variables.company == 'PQR Org' ||current.variables.company == 'ABC Org') && current.variables.job_type == 'Misc') query = 'country=Australia^ORcountry=Brasil^ORcountry=Japan'; query;

@rishabh31  - please try this:

javascript: var query ; if(current.variables.company == 'ABC Org' && current.variables.job_type == 'InDependent') query = 'country=Canada^ORcountry=USA';
else if(current.variables.company == 'XYZ Org' && current.variables.job_type == 'InDependent')  query = 'country=Italy';
else if((current.variables.company == 'XYZ Org' || current.variables.company == 'PQR Org' ||current.variables.company == 'ABC Org') && current.variables.job_type == 'Dependent') query = 'country=Australia';
else if((current.variables.company == 'XYZ Org' || current.variables.company == 'PQR Org' ||current.variables.company == 'ABC Org') && current.variables.job_type == 'Misc') query = 'country=Australia^ORcountry=Brasil^ORcountry=Japan'; query;

Hi @Karan Chhabra6 

Tried this new ref qual (Pls see if is there anything wrong in my modification of 'javascript:  -----') but not getting result

 

 

javascript:var query ; if(current.variables.company == 'ABC Org' && current.variables.job_type == 'InDependent') query = 'country=Canada^ORcountry=USA';
else if(current.variables.company == 'XYZ Org' && current.variables.job_type == 'InDependent')  query = 'country=Italy';
else if((current.variables.company == 'XYZ Org' || current.variables.company == 'PQR Org' ||current.variables.company == 'ABC Org') && current.variables.job_type == 'Dependent') query = 'country=Australia';
else if((current.variables.company == 'XYZ Org' || current.variables.company == 'PQR Org' ||current.variables.company == 'ABC Org') && current.variables.job_type == 'Misc') query = 'country=Australia^ORcountry=Brasil^ORcountry=Japan'; query;

 

rishabh31_0-1682767515933.png