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.
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
You will revive a list of all the Financial Type labels and their ID numbers.
"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. ;)
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();