Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
C
Core
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 924
    • Issues 924
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
  • Development
  • Core
  • Issues
  • #417

Closed
Open
Opened Oct 02, 2018 by jensschuppe@jensschuppe

Address.create API call: Untranslated province names are invalid options for field state_province_id

When calling the Address.create API call with a state_province_id set to the untranslated name of a province (as in its name attribute in the DB), and this province being translated in the current default language, an API error 'XYZ' is not a valid option for field state_province_id is returned and the address is not being created/updated.

Being aware of this field ideally receiving the actual state_province ID instead of its name, this might be a minor issue, but it makes manual imports a mess, if we'd have to issue another API call first to retrieve the ID from the untranslated name, which is the actual value in the DB. So this error causes quite some confusion.

Steps to reproduce:

  1. Set CiviCRM's default language to e.g. German
  2. Find a state province which is translated (e.g. Switzerland's Geneva, which is "Genf" in German)
  3. Issue an Address.create API call with the following parameters:
{
  "contact_id": 123, // A valid contact ID
  "location_type_id": "Home",
  "country_id": "CH",
  "state_province_id": "Geneva",
}
  1. Notice the API error.
To upload designs, you'll need to enable LFS and have admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: dev/core#417