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) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • return.custom_X stopped working
Pages: [1]

Author Topic: return.custom_X stopped working  (Read 944 times)

bpmccain

  • I post frequently
  • ***
  • Posts: 255
  • Karma: 5
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.12
  • MySQL version: 5.2
  • PHP version: 5.2
return.custom_X stopped working
April 04, 2012, 04:01:00 pm
This one has me stumped - I've used this feature 100's of times, and it was working until 15 minutes ago - then suddenly stopped.

Code: [Select]
$permissionParams = array (
'version' =>'3',
'id' => $internalID,
'return.custom_9' => 1,
'return.custom_10' => 1
);

$results=civicrm_api("Contact","get", $permissionParams);

is just returning:

Code: [Select]
Array ( [is_error] => 0 [version] => 3 [count] => 1 [id] => 1 [values] => Array ( [1] => Array ( [contact_id] => 1 [id] => 1 ) ) )
And not returning the values of custom_9 and custom_10. The custom values are still defined as I can see them when I view the contact, and if I search using the API for contacts with custom_9 = 1 for example, it successfully returns the right contacts.

What's going on?

Brian

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: return.custom_X stopped working
April 05, 2012, 02:59:20 am
Ghost in the machine?

Can you reproduce on the demo site, see if it is a local config issue?
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

bpmccain

  • I post frequently
  • ***
  • Posts: 255
  • Karma: 5
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.12
  • MySQL version: 5.2
  • PHP version: 5.2
Re: return.custom_X stopped working
April 05, 2012, 07:01:05 am
I don't know how I would go about testing it on the demo site, as the code is called in a custom search - and I don't know how to run the code without uploading new files to the install.

Is there a way to use the API explorer and generator and ask it to return specific fields? When I use the API in a php file, I use return.custom_9 => 1, but is there a way to do that using the URL method in the API explorer and generator?

Brian

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: return.custom_X stopped working
April 05, 2012, 07:35:40 am
using the api explorer to run the query in ajax mode

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

bpmccain

  • I post frequently
  • ***
  • Posts: 255
  • Karma: 5
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.12
  • MySQL version: 5.2
  • PHP version: 5.2
Re: return.custom_X stopped working
April 05, 2012, 07:45:00 am
The problem has been solved - and I still have no idea what happened. I did some more investigating, and the API would return any custom values that were part of my first set of Custom Fields. Nothing from the remaining five sets of custom fields.

So I went into one of the non-functional sets of custom fields, hit settings, looked them over, didn't change anything, hit save, and ran the code again, and everything worked perfectly.

I think it was a ghost!

jmlunning

  • I’m new here
  • *
  • Posts: 1
  • Karma: 0
  • CiviCRM version: various
  • CMS version: various
  • MySQL version: various
  • PHP version: various
Re: return.custom_X stopped working
August 11, 2014, 07:10:08 pm
Just a note to say I had this problem too the other day with CiviCRM version 4.4.3 running on Drupal 7.  All my custom fields that were attached to Contacts stopped returning in api calls one day out of the blue.  Worked hundreds of times before as well.  We make heavy use of the api.  I could see the custom data through the normal CiviCRM UI and my custom fields tied to Events and Activities were returning fine via api calls.  Just Contact custom fields would not.

I found this forum posting via a Google search and did the same thing that bpmccain did, which was open up the custom field sets with the admin console and simply click save.  Then they started working again.  Real strange.   Make that a ghost in two machines now...

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • return.custom_X stopped working

This forum was archived on 2017-11-26.