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.
3 Answers
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. ;)
-
You should use get over getlist... Because not all entity is configured to use getlist Oct 12, 2018 at 18:27
-
Want to let us know how you would get the financial type ID via the API V4?– themakOct 12, 2018 at 18:37
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
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();