+ Start a Discussion

Address fields and dependency fields

Issue 1. Account object its enabled to have 2 address fields. What if I need another one?


Issue 2. Standard Address fields are great but what about typo errors when inserting a city name? Example Dallas and Dalas. It seems that the platform lets you insert this errors and I still haven't found a way to avoid this. This error gets priority 1 when you are asked to get reports by city.


Issue 3. I haven't found an actual way to validate that a city belongs to a state, in order to prevent a user to insert something like Chicago, TX



In order to avoid mispelling city names and limiting the user to select a real city from a real state I thought about 2 possible solutions:


Solution 1: make custom fields address, city, state. Cascading the content on city field depending on state field, and combining the three fields into one just like Address data type. (HAVEN'T FOUND A WAY TO ACTUALLY DO THIS)


Solution 2: make 3 custom objects Address, City, State with relationships like this:


Account 1:N Address 

Address N:1 City (lookup relationship)

City N:1 State (lookup relationship)


Once I desgined the 3 custom objects I realized these obstacles:

A) I can't get to make the City field dependant on the State field, since this is not allowed on lookup fields.

B) I can't get the Address object into the Account layout as a related list in order the user can click on New button inside the Accounts page and create a new Address.


Any suggestions?


I think I figure it out. I created 3 custom objects: Address, City, State.


City has a lookup field on State.

Address has the following fields:

-Street and number (text)

-Address type (lookup field with values like: home, office, shipping, billing, etc) 

-zip code (text field)

-City (lookup field filtered to the State field)

-State (lookup field on State object)

-Account (master-detail on Account object)


  1. I put the following filter on Address.City field:
    City: State ID EQUALS Address: State ID
  2. I customized the layout for the lookup dialog on City object so the State name appears as well (useful in case there's more than one city with the same name)
  3. I customized the Address related list on Account so it displays not just the ID, but the rest of the Address fields so it's more friendly.
  4. Now on Account page I have the option to add, edit, delete as many Addresses as I wish just like any other related list.