How to get dependent values based on another Lookup selectbox ?

meragz
Tera Contributor

Hi ,

 

My requirement is 

 

 

 

 

I have a table called countries which contains country and city names . Two Lookup selectBox I am using 1 for Country and another Lookup selectbox for city .

 

Once I select Australia in first control in the second Lookup box it should filter and show   Sydney,Perth,Melbourne same for other countries . How to I apply filter using Reference qual or any other way .

 

 

 

 

 

Country           City

Australia          Sydney

Australia         Perth

Australia         Melbourne

America          Austin

America          Seattle

America          Boston

Newzealand    Auckland

Newzealand    Wellington

4 REPLIES 4

Harshal Aditya
Mega Sage
Mega Sage

Hi @meragz ,

 

Hope you are doing well.

 

Please refer below link for your query

https://www.servicenow.com/community/itsm-forum/lookup-select-box-reference-qualifier-help/m-p/61045...

 

Please mark this response as correct or helpful if it assisted you with your question.

Regards,
Harshal

Thanks Harsha ,

 

I tried but I am little confused so I am not getting the desired output . If possible how to use the Above table (Country table ) and give an example.

 

Thanks in advance .

A Kose
Tera Contributor

I am sure you have figured this out but just in case

Set this up for the city variable Lookup Select Box:

RQ: javascript:"countries="+current.variables.country;

Variables: ref_qual_elements=country

assuming your table name is countries and the variable country is what the city depends on. Check if this is set up on the dictionary entry for city as well,  that it depends on country.

DrewW
Mega Sage
Mega Sage

If the City table has a Country field and that Country field points to the same table as the Country field on your form then you should be able to just make the City field on the form dependent on the Country field that is on your form.

 

https://docs.servicenow.com/en-US/bundle/utah-platform-administration/page/administer/field-administ...