How to display locations based on country in catalog

yoli1
Tera Contributor

Hello everyone can someone help me figure out why this doesn't work i want to display locations based on value put in country

i have two fields : location and country

Capture.PNG

9 REPLIES 9

Craig Gruwell
Mega Sage

Thanks - I was using the cmn_location table, so that explains the difference.   For the core_country table, it will be using the sys_id as the selected value so you'll want to update Ref Qual on the Location variable to:

 

current.variables.country.getDisplayValue();

Works now thanks @Craig Gruwell for my Location field i want to remove a location from showing in the list how can i do that?

You'll want to append that condition to your Ref Qual, such as:

 

'country=' + current.variables.country + '^name!=<name of country to exclude>';

or

'country=' + current.variables.country + '^sys_id!=<sys_id of country to exclude>';

 

 

Craig Gruwell
Mega Sage

Actually that might partially work.  The display values for the core_country table may differ slightly with the Country values in the cmn_location table.  It might work for some but not others.   For example, core_country uses "United States of America" but the Country field in the Location table uses "USA".    You might want to use the cmn_location table instead of the core_county table to avoid this issue.    Refer to screenshot if that helps.

 

 

Vishal Birajdar
Giga Sage

Hello yoli1,

 

It depends upon type of variable you used.

Have you used "Country" variable as "Reference" ?

If yes then in your reference qualifier - 

javascript&colon;"u_country=" + current.variables.country;

current.variables.country : you will get the sys_id

 

so in location table if "u_country" is reference field then it should work else it will not work.

  

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates