Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Need to populate location field based on the country selection

rog
Giga Contributor

Hi all,

 

I have a requirement where in we need to populate the location (reference to cmn_location) value based on the selection of country (reference to core_country). If for example countries Japan and China are selected then on the locations that are active under these countries should be available for selection in location field.

 

I got to know that we need to achieve this through script include and advance reference qualifier since the location field is a reference field.

 

Could you please help me with the script, Im fairly new to scripting and would be a great learning for me.

 

Thanks in advance.

28 REPLIES 28

Alikutty A
Tera Sage

Hello,

Can you try this out? On the advanced reference qualifier of Location field add this script.

javascript: country=current.u_country.getDisplayValue();  //u_country is the name of your country reference field

Also make sure the country name is same as that in Location table

Thanks

rog
Giga Contributor

Hi,

 

I have updated the advanced reference qualifier on the location field but still it is not working. It showing all the locations from all the countries.

I missed to add quotes, Please change this line to

javascript: 'country='+current.u_country.getDisplayValue();

rog
Giga Contributor

I have tried the above script in the advance qualifier of the location field now it is showing empty in the location field even if I select country. Please suggest.