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

Can't find state_province_id by abbreviation in API

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.5.6, 4.6
    • Fix Version/s: None
    • Component/s: CiviCRM API
    • Labels:
      None
    • Documentation Required?:
      Developer Doc

      Description

      So, let's say you're being good and don't want to use the deprecated Constant API. If you want to find what state_province_id Maryland is, you can just do
      civicrm_api3('Address', 'getoptions', array(
      'field' => "state_province_id",
      'value' => "Maryland",
      'country_id' => 1228,
      ));

      Adding the country_id works--you can make sure you're getting the one in the US and not Maryland, Liberia. However, there's no way to get a state by abbreviation. I want to do something like:
      civicrm_api3('Address', 'getoptions', array(
      'field' => "state_province_id",
      'abbreviation' => "MD",
      'country_id' => 1228,
      ));

        Attachments

          Activity

            People

            • Assignee:
              colemanw Coleman Watts
              Reporter:
              andrewhunt Andrew Hunt
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: