2

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.

  • Please clarify the name of the report template you're using? – Jon G - Megaphone Tech Oct 28 at 12:12
  • Actually no particular Event Report template, it seems that all of them does not allow for custom fields of the associated Contribution Record to be included in the report. Thanks. – Clement Leong Oct 29 at 8:54
2

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.

0

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 ParticipantExtended.php file.

You'll see this at the top (line 15):

  protected $_customGroupExtends = array(
    'Participant',
    'Contact',
    'Individual',
    'Event',
  );

Insert '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.

  • Thanks, i just checked Extended Report Extesion (v4.5) on CIVICRM (5.13.5, Wordpress 5.0) and it looks like it shows the custom fields for Contacts and Participants Record but not the Contribution Records. :( . Or am i missing something ? Thanks. – Clement Leong Oct 30 at 2:03
  • Ah, you're right. I'll update this answer. – Jon G - Megaphone Tech Oct 30 at 20:00
  • I also see that Alan provided the same answer in not as many words :) – Jon G - Megaphone Tech Oct 30 at 20:09
  • Thanks to all. I have tried as Jon's suggestion and the custom fields appeared in Extended Report - Participant Template instead of the Extended Report - Participant Line Items template. However, when i was trying to gen a report with the Participant Template to show the said custom field, it would complain of a DB Error. Thanks for any further advice. – Clement Leong Nov 5 at 3:58
  • That sounds like a separate issue. Enable debugging/backtrace, trigger the DB error, and open a new question that includes both the error and backtrace? – Jon G - Megaphone Tech Nov 12 at 15:16

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.