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

OptionValue API create fails to auto-increment value when weight is specified

    Details

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

      Description

      When using the API to create a new OptionValue, if you don't specify the value, it's supposed to auto-increment, i.e. the new OptionValue will have a value one higher than the OptionGroup's previous highest. That's what it did in CiviCRM 4.2.

      However, in 4.3, if you specify the weight but not the value, repeated calls to OptionValue create do not auto-increment the value, so you can end up with more than one OptionValue in the same OptionGroup having the same value.

      To replicate this, use the API or API explorer to create an OptionValue specifying option_group_id and weight but not value. The first OptionValue thus created will be fine. However, all OptionValues subsequently created by calling API create with the same parameters will have a value one higher than the specified weight instead of having a value one higher than the OptionGroup's previous highest.

        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: