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

OptionValue API create doesn't work as update

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.2.1
    • Fix Version/s: 4.3.0
    • Component/s: CiviCRM API
    • Labels:

      Description

      When trying to update an existing OptionValue by calling API create with the OptionValue's ID, a fatal error occurs. This is because OptionValue create requires the option_group_id to be supplied.

      The option_group_id field should be required when creating a new OptionValue, but should not be necessary when updating an existing OptionValue.

      Furthermore, using API create to update an existing OptionValue alters the values of certain fields if they are not supplied. In particular, it resets the is_default and is_active fields to their default values, and it sets the value and weight fields to the next values in the sequence.

      NB: Across the API, the create action is now the preferred way to update entities. It is more efficient than API update, as API update just calls API get and then passes the fields to API create.

        Attachments

          Activity

            People

            • Assignee:
              eileen Eileen McNaughton
              Reporter:
              kirk Kirk Jackson
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: