Is it possible (via extension perhaps) to get a custom field from a related contribution record to be included in a Event Report ? For example, in a paid event registration, this would create a associated contribution record and a custom field created in the contribution record. How can I do a Event report which will include the Contribution record custom field ? the current Report function doesn't seem to allow that. Thanks.
If you have a report that doesn't show the custom fields on an entity, it might be because those fields are not configured as searchable (yes, a very non-obvious thing). If that's the issue, then it's the same as this question/answer: Custom fields in the Report Templates
Alternatively, if it's a problem with the report itself, you can generally hack it with something like the below at the top of the class file:
protected $_customGroupExtends = array( 'Contact', 'Individual', 'Contribution', );
If you're seeing some custom fields but not the ones for Contributions, just adding in the Contribution entry to your current values should work.
If you open the file that provides the report, you can generally add the custom fields with a single line.
For instance, if you're using Extended Reports extension, the "Extended Report - Participant Line Items" report template is a good one to add contribution custom fields to.
So, for instance, find the files for Extended Report. You can find their server location thusly:
- Go to Administer menu » System Settings » Extensions.
- Click the triangle next to ExtendedReport to see expanded info (see screenshot).
- Note the local path listed.
On your server, go to that folder, then navigate to the subfolder
CRM/Extendedreport/Form/Report/Event and open the
You'll see this at the top (line 15):
protected $_customGroupExtends = array( 'Participant', 'Contact', 'Individual', 'Event', );
'Contribution', anywhere inside those parentheses (e.g. after
'Event',) save, and reload the report. You should have contribution custom fields.
This change will be overwritten when you upgrade Extended Reports - but if you test it, it works, and you believe it's a useful addition, ping me on chat.civicrm.org (name in my bio) and I'll submit it to the author as an improvement.