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) »
  • financial_type_id not returned on Contribution get?
Pages: [1]

Author Topic: financial_type_id not returned on Contribution get?  (Read 340 times)

norris

  • I’m new here
  • *
  • Posts: 19
  • Karma: 0
  • CiviCRM version: 4.6.0
  • CMS version: Joomla
  • MySQL version: 5.5.41-37.0-log
  • PHP version: 5.4.24
financial_type_id not returned on Contribution get?
March 15, 2015, 01:51:28 pm
I'm new to CiviCRM and the API, so apologies if I'm just making some basic mistake.  I can't get this to work either on my own Joomla / CiviCRM 4.5.8 test system, or in the joomla sandbox.

If I create some contributions, then use the API explorer or my own hooks to try to get the financial_type_id, it isn't returned.  For example, after creating one "Donation" and one "Member Dues" contribution in the sandbox, I used the api explorer to set up:

$result = civicrm_api3('Contribution', 'get', array(
  'sequential' => 1,
  'return' => "financial_type_id,total_amount",
));

But the results don't include that field:

{
   "is_error":0,
   "version":3,
   "count":2,
   "values":[{
      "contact_id":"3",
      "contribution_id":"1",
      "total_amount":"10.00",
      "id":"1"
   },
   {
      "contact_id":"3",
      "contribution_id":"2",
      "total_amount":"10.00",
      "id":"2"
   }]

I encountered a similar problem earlier, maybe with Contacts, where a requested field wasn't returned unless I also specified other field(s), but I don't remember the details now...if I run into that again, I'll post details.

Thanks for any help!

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: financial_type_id not returned on Contribution get?
March 16, 2015, 12:45:31 am
I do get the financial type if I do a get without a return. So a:
Code: [Select]
$result = civicrm_api3('Contribution', 'Get', array());
does show the financial_type_id in my install.

But adding the return shows the same problem for me. So as a quick fix I would not use the return parameter, and file a bug on the Issue Tracker (or even better if you can, fix it following the instructions here http://wiki.civicrm.org/confluence/display/CRMDOC/GitHub+for+CiviCRM)
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • financial_type_id not returned on Contribution get?

This forum was archived on 2017-11-26.