2

I have created some custom fields for Contacts and want to display these fields in a membership report that we call member mailing list. However I am unable to see the custom fields for Contacts as display columns in the report even though they are marked as searchable

enter image description here

3
  • Do you see any core contact field in the columns? first_name, last_name, etc? Apr 10, 2018 at 10:07
  • Yes I can see the core contact fields. Just not the custom ones Apr 10, 2018 at 10:08
  • can you share the screenshot of the report criteria? Apr 10, 2018 at 10:10

2 Answers 2

2

If you can open the report file from your codebase, you can add the entity name to the _customGroupExtends variable array initialized at the top of the file of almost every report in CiviCRM.

protected $_customGroupExtends = array('Contact');

The above line will include all contact custom set in your report. You can add Individual, Membership to display custom group extending these entities too.

To see which file is used for the report, you can refresh the result to get a Developer tab which contains the class name used to display the result.

enter image description here

So the file which is used in above report is -

/path_to_civicrm/CRM/Report/Form/Member/Detail.php

4
  • ok great I will try this and let u know if it works. Thank you Apr 10, 2018 at 10:33
  • Hi Jitendra.how do I locate the file for this report to update the code? Sorry Im having trouble finding it Apr 12, 2018 at 0:08
  • updated the answer to locate the file for the report Apr 12, 2018 at 3:01
  • Great - you can accept this answer with a green tick to complete this question on SE. Apr 15, 2018 at 5:25
2

Look for custom fields in a fieldset below the ‘standard’ report fields - here’s an example for another type of report - but clearly shows the custom data sets (if they have been marked searchable in the custom data set configuration) as fieldsets in the report - click them open and you’ll see the custom fileds

enter image description here Second thought: Extended Report extension: https://civicrm.org/extensions/extended-reports - you can download/install it from your Manage Extensions screen. It introduces a number of report templates - some of which will have many customfields extended (in fieldsets) so no core code edit required.

2
  • Thanks KarinG we already have extended reports but couldnt find one that meets our criteria. The current report is showing me custom fields for memberships but I need to access the custom fields for Contacts Apr 10, 2018 at 13:57
  • In that case you’lll have to either make the edit Jitendra mentions above directly in core or add a custom_php override and just override that report Apr 11, 2018 at 4:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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