4

I am trying to import hundreds of contribution records and it is requiring I include the Financial Type ID when importing. Simply having the word Donation is not enough! When I visit Administer - CiviContribute - Financial Types, it does not display the Financial Type ID.

5

When importing contributions, you must specify the Financial Type in the form of the Financial Type ID. Unfortunately going to Administer - CiviContribute - Financial Types does not display the Financial Type ID. You must get the Financial Type ID from the API Explorer

Go to Support - Developer - then one of the following:

API Explorer V3

  • Entity: Financial Type
  • Action: getlist
  • Parameters: Leave blank
  • Execute

You will revive a list of all the Financial Type labels and their ID numbers.

For example:

  "id": "7",
        "label": "Money Donations",
        "description": [
            "For all monetary donations.  "

In this case 7 is the Financial Type ID for Money Donations

API Explorer V4

  • Good luck and
  • don't !@#$ it up.

So pretty much use V3 as v4 does not use getlist. ;)

2
  • You should use get over getlist... Because not all entity is configured to use getlist – Pradeep Nayak Oct 12 '18 at 18:27
  • Want to let us know how you would get the financial type ID via the API V4? – themak Oct 12 '18 at 18:37
3

For those who want to do this via the UI I believe this is as simple as going to civicrm/admin/financial/financialType?reset=1 and mousing over or clicking on Edit for each Financial Type and the ID will show in the url

1

For anyone else looking for this, you can use the getFields action on the Contribution entity to locate the options for the Financial Type ID.

$fields = \Civi\Api4\Contribution::getFields()
  ->setLoadOptions([
    'id', 
    'name', 
    'label', 
    'abbr', 
    'description', 
    'color', 
    'icon',
  ])
  ->addWhere('options', '!=', FALSE)
  ->addWhere('name', '=', 'financial_type_id')
  ->execute();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.