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
2 Answers
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.
So the file which is used in above report is -
/path_to_civicrm/CRM/Report/Form/Member/Detail.php
-
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
-
-
Great - you can accept this answer with a green tick to complete this question on SE. Apr 15, 2018 at 5:25
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
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.
-
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
first_name
,last_name
, etc?