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

Using optionValue create api for updating a field say is_active by passing just 'id' value for it throws api exception error

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.3.0, 4.4.0
    • Fix Version/s: 4.4.3
    • Component/s: None
    • Labels:
      None

      Description

      using api call :

      // i want to disable option value with id = 2
      $result = civicrm_api3('option_value', 'create', array('id' => 2, 'is_active' => 0));

      throws :

      CiviCRM_API3_Exception: A fatal error was triggered in civicrm_api3() (line 254 of /home/pratik/git/v44/api/api.php).

      This fatal error is raised due to not passing the option_group_id to params used to update a option value.

      Raised from here - CRM_Core_BAO_OptionValue::add() function line 201 :

      $groupName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup',
      $params['option_group_id'], 'name', 'id'
      );

        Attachments

          Activity

            People

            • Assignee:
              pratik.joshi Pratik Joshi
              Reporter:
              pratik.joshi Pratik Joshi
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: