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) »
  • 'How to use custom data in the api' documentation
Pages: 1 [2]

Author Topic: 'How to use custom data in the api' documentation  (Read 4582 times)

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: 'How to use custom data in the api' documentation
October 26, 2012, 07:08:56 am
Ahhhhh Eileen please....they really are cute  ;D
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: 'How to use custom data in the api' documentation
October 26, 2012, 09:45:50 am
You know, I think I wrote that api B.C.
Try asking your question on the new CiviCRM help site.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: 'How to use custom data in the api' documentation
October 26, 2012, 04:57:43 pm
B.C.!!!! OMG

Perhaps you hadn't been exposed to the 'y loop' back then & hadn't learnt to explain things so verbosely the first time that there's at least a chance of avoiding the dreaded Y-word.
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: 'How to use custom data in the api' documentation
October 26, 2012, 09:41:07 pm

As an interesting twist of events, the A team, in their endless quest for efficiency, seems to have given up on words.

Having to wait for the beer to warm, I have to admit, was a bit too time confusing, however...

WTF?

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

robinhood

  • I post frequently
  • ***
  • Posts: 153
  • Karma: 6
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
  • MySQL version: 5.1.56
  • PHP version: 5.3.5
Re: 'How to use custom data in the api' documentation
October 28, 2012, 06:58:00 am
Quote from: chriscant on August 12, 2012, 04:31:03 am
To set or update a custom value, this works:

$params = array(
   'version' => 3,
   'entity_id' => $cid,
   'custom_133' => 'value',
);
civicrm_api( 'custom_value','create',$params );
I can't make this one work.  It does not return any error, but it does not change the database either, on version 4.2.2.  What is the secret?

chriscant

  • I post occasionally
  • **
  • Posts: 66
  • Karma: 4
    • PHDCC
  • CiviCRM version: 4.2.19
Re: 'How to use custom data in the api' documentation
October 28, 2012, 08:50:50 am
Have you got the right number for the custom field, ie to replace the "133"?
One way to find this is by going to your custom data list, then click the appropriate View and Edit Custom Fields then click Edit Field on the right one - look at the id at the end of the URL.
Chris
PS  Mine is working on 4.0.7.

robinhood

  • I post frequently
  • ***
  • Posts: 153
  • Karma: 6
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
  • MySQL version: 5.1.56
  • PHP version: 5.3.5
Re: 'How to use custom data in the api' documentation
October 28, 2012, 11:51:22 am
Yes I am using the right number.  Is this something that would have changed between 4.0 and 4.2?

« Last Edit: October 28, 2012, 11:54:09 am by robinhood »

chriscant

  • I post occasionally
  • **
  • Posts: 66
  • Karma: 4
    • PHDCC
  • CiviCRM version: 4.2.19
Re: 'How to use custom data in the api' documentation
October 28, 2012, 11:58:43 am
Sorry, don't know.  Chris

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: 'How to use custom data in the api' documentation
October 28, 2012, 12:02:06 pm
Try another ID as a test. Or try

civicrm_api( 'custom_value','update',$params );

perhaps. Although it appears that your code is correct:

http://api.civicrm.org/v3/CiviCRM_APIv3/API_CustomField/_api---v3---CustomValue.php.html#functioncivicrm_api3_custom_value_create

Anyhow, play with it a bit I guess. Did you try the API explorer?
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

robinhood

  • I post frequently
  • ***
  • Posts: 153
  • Karma: 6
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
  • MySQL version: 5.1.56
  • PHP version: 5.3.5
Re: 'How to use custom data in the api' documentation
October 29, 2012, 04:41:04 am
Ok I got it.  Helps if you look in the right table.  civicrm_custom_value is no longer used but is still hanging around in my DB from prior versions.  Thanks.

Pages: 1 [2]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • 'How to use custom data in the api' documentation

This forum was archived on 2017-11-26.