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

Custom fields not working with Relationship API

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 2.2.6
    • Fix Version/s: 3.0
    • Component/s: CiviCRM API
    • Labels:
      None

      Description

      1. Relationship API does not add custom field.
      This is a piece of my codes for adding a relationship:

      #############
      $relationship_params = array(
      'contact_id_a' => $data['contact_a'],
      'contact_id_b' => $data['new_branch_id'],
      'relationship_type_id' => $this->relationship_type_id,
      'start_date' => array('d'=>$r_end_date[0],'M'=>$r_end_date[1],'Y'=>$r_end_date[2]),
      'is_active' => 1,
      'custom_56' => "test custom field"
      );

      2. Relationship api - civicrm_contact_relationship_get - fails to retrieve custom data that is attached to a relationship.

      • CRM_Core_BAO_CustomGroup::getTree is using old param format (missing $form param 2)
      • CRM_Core_BAO_CustomGroup::formatGroupTree is required prior to CRM_Core_BAO_CustomGroup::setDefaults

      $new_relationship = & civicrm_relationship_create( $relationship_params );
      ############

      #The custom field wasn't added through this params.

      It looks like formating the custom data function not in api/v2/Relationship.php.

        Attachments

          Activity

            People

            • Assignee:
              amit Amiteshwar Prasad
              Reporter:
              rui Rui Duan
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: