Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-17572

States and Counties don't chain in Search Builder


    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      User and Admin Doc
    • Funding Source:
      Needs Funding


      Many states and counties have common names. Maryland could be in Liberia or the United States. There are 3 states named "Distrito Federal". Within the US, there are 18 counties named Montgomery.

      The Search Builder state and county fields don't filter with reference to the country or state fields that are within the same AND grouping. The state field displays the states from the countries that have states enabled, and the county field displays all counties in alphabetical order.

      This presents two problems:

      1. If you have multiple options with the same name, you have no idea which is which. Is "Distrito Federal" in Brazil, Mexico, or Venezuela? Which of the 31 "Washington" counties is the right one? There's no way to input the ID anymore if you happen to know.
      2. If you are looking for a state that's not in one of the countries you have set for "available states and provinces", you're out of luck.

      Two proposed alternatives:

      1. Make the states drop-down depend upon a country of the same location type, within the same "AND" grouping. Do the same for the counties with regard to the states. This would require some kind of parameter to be sent to the address/getoptions API to filter the list, but it would make them work in the same way as elsewhere in CiviCRM.
      2. Have a new context for address/getoptions that prefixes the state name with the country and prefixes the county name with the state. (We can probably safely assume that the same county/state combinations appear in multiple countries--no Montgomery County, Maryland, Liberia.) This means that a user doesn't need to add redundant criteria to the search.

      For the second option, that doesn't solve the problem of picking states in other countries, but maybe a checkbox could alternate between showing all countries' states (maybe setting the context as "get" instead of "search").




            • Assignee:
              andrewhunt Andrew Hunt
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: