Taking Cmn_loaction Reference for four fields Country, City, State, Address

VikramM1
Tera Contributor

Hi,

 

I have created four fields for all Country, City, State, Address and Taking Cmn_loaction Reference for all four fields.

 

When i select country: only country should be displayed.

When i select State: based on the country selected state should be displayed.

When i select City: Based on country and state selected. City should display.

 When i select Adress: Based on country and state and city selected. address should display.

 

But, all are showing only address.

 

How to acheive this in service now table form. Can someone help me on this?

13 REPLIES 13

But, if i give display value true for one field for all feilds it takes same

Hello, @VikramM1 

 

Do you came up with a solution for that

 

Actually, my proposal suggests that you write to the attributes of the custom fields in the sys_dictionary table. This way, you are setting ref_ac_columns to determine which variables are visible in the reference variable. You are not changing the display value of the cmn_location.

 

This is what I mean: 

kkrushkov_0-1712237385334.png

 

 

But as I mentioned in my previous response, this is what it will look like (displaying the full address name since it is the Display Value in the cmn_location table), which may not be the desired outcome.

kkrushkov_1-1712237679364.png

 

Thanks for your tries and approaches. I will find a different way then.

Sandeep Rajput
Tera Patron
Tera Patron

@VikramM1 You need to add following reference qualifier on your fields.

 

1. Country field:

 

 

javascript:'cmn_location_type=country'

 

 

2. State

 

 

javascript: 'country='+current.variables.country

 

 

3. City

 

 

javascript: 'country='+current.variables.country+'^state='+current.variables.state

 

 

 4. Address

 

 

javascript: 'country='+current.variables.country+'^state='+current.variables.state+'^city='+current.variables.city

 

 

 

Here is how the reference qualifier should look on address field. Similarly configure for others.

 

Screenshot 2024-04-02 at 1.18.24 PM.png

 

You can read more about reference qualifier here https://docs.servicenow.com/bundle/washingtondc-platform-administration/page/script/server-scripting....

 

Hope this helps.