CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • API + Custom Fields; values not set, but no errors returned
Pages: [1]

Author Topic: API + Custom Fields; values not set, but no errors returned  (Read 1343 times)

jbachmann

  • Guest
API + Custom Fields; values not set, but no errors returned
November 23, 2009, 09:05:43 am
I've been working with CiviCRM for a little while now, using the Contact API to save custom fields to a Contact record from a custom UI. This has been working beautifully on both my local development copy as well as on my company's staging server. We're configuring the production server now and everything appears to be identical between our staging server and the production (custom group table names, custom field column names) but when attempting to save the custom fields from our custom UI page, only parts of the hash passed to the Contact API are saved properly -- The base contact information is saved, and all fields for two of our custom field groups are saving, but a third custom field group refuses to save any of the fields, additionally, no row is created in the third custom field group table. Even after saving false data for that custom field group for the same Contact from within the CiviCRM interface, the API also won't update the information with data from our custom UI page.

The really unfortunate part is that when I print_r the civicrm_contact_add result, it says that there are no errors. It's as if the API doesn't even know that the tables exist and doesn't even care.

I've double and triple checked the table and column names to be sure that they all match the ones in the staging server (and thus, the custom field values in the hash we pass to the API from our custom UI). But maybe I keep missing one?

We did have to deploy the system in a somewhat odd fashion, due to the fact that CiviCRM was already deployed to production and was live for one department of the organization.
Because they had already been creating a few custom fields, and the amount of custom fields which we needed to add to the system for the second department to go live, we went through and re-numbered all of the custom field and table data which was entered between the first department's deployment (so that the ID's wouldn't conflict with any incoming group or field ID's), after that we copied the table structures from the staging server into production and any applicable rows from the custom_group, custom_field, option_group and option_value tables.

Some of the tables we migrated over save custom data just fine, others don't.

We're coming down to a tight deadline, so any help would be greatly appreciated. Any thoughts on additional ways to try to debug this, or perhaps someone has encountered this problem before. I doubt it's anything related to the API, and can almost guarantee that it has something to do with how the database was migrated. Maybe there is a cache table I need to clear.



Thanks so much,
Jordan

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: API + Custom Fields; values not set, but no errors returned
November 23, 2009, 09:12:01 am

in your mysql db do this:

mysql> truncate civicrm_cache;
mysql> truncate civicrm_acl_cache;

see if that fixes the issue (i think it will)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

jbachmann

  • Guest
Re: API + Custom Fields; values not set, but no errors returned
November 23, 2009, 09:49:48 am
Hi Donald,

Thank you for the quick reply.

I've cleared those two cache tables, unfortunately my issue remains.

I've also cleared all of the Drupal cache tables (for other reasons).

jbachmann

  • Guest
Re: API + Custom Fields; values not set, but no errors returned
November 23, 2009, 10:10:10 am
I know that my issue is probably just generally vague. If there is specific information that would be helpful to see I can provide it.

Contents of Hash being passed to Contact API.
Result Hash returned from API call.
Custom field group database table name which I can't save into
Custom field group database table column name(s) which I can't save.
custom_group row associated with custom field group database table.
custom_field row for column which won't save.


What are your top of mind reasons why this could be happening?

Thanks.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • API + Custom Fields; values not set, but no errors returned

This forum was archived on 2017-11-26.