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

Custom Fields Not Updating with API

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.1
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      Could not get the API to add custom fields. Here are the steps - I'm using Beta 4 with Drupal 6.x -

      Logged into Drupal
      Went to /civicrm
      Went to /civicrm/admin?reset=1
      Went to admin/custom/group?reset=1
      Chose "New Group..."
      Gave a Group Name, specified for Contacts, saved
      Added 3 fields with the UI - "State", "Party", "First Time" - all alphanumeric, all searchable
      Found the field id number by looking at the URL for the edit (and confirmed in
      Executed the following code:

      <?php
      $params = array( 'contact_type' => 'Individual',
      'first_name' => 'Foo',
      'last_name' => 'Fighter',
      'custom_4' => 'Edu',);
      require_once '../civicrm.config.php';
      require_once 'api/v2/Contact.php';
      $result = civicrm_contact_add( $params );
      CRM_Core_Error::debug( $result );
      ?>

      The user was added but the custom field did not populate.

      truncated civicrm_cache and then it worked.

        Attachments

          Activity

            People

            • Assignee:
              sunil Sunil Pawar
              Reporter:
              drob Dan Robinson
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: