Awhile back, I have made a copy of the the CRM/Report/Form/Activity.php, placed it under custom_php and added additional custom Contact and Case fields to the report by updating

protected $_customGroupExtends = [    'Activity' ];


  protected $_customGroupExtends = [

I know this question indicates this was the proper way 4 years ago. I am wondering whether this is still the proper way to show Contact and Case custom fields on Activity report with the current version of CiviCRM 5.57.2?

2 Answers 2


Yes _customGroupExtends will still work. You probably want to sync any changes in CRM/Report/Form/Activity.php from the last 4 years into your custom file. But there's an argument that the time would be better spent making a new searchkit search that replaces what the custom report does, but it's true not all civireport features are available yet in searchkit.


I avoid creating custom php over-rides as it will need checks/updates when Civi is upgraded. I added the same thing using the extension. Below is an example how I achieved

function extensionname_civicrm_alterReportVar($varType, &$var, &$object) {
  if ('columns' == $varType && get_class($object) == 'CRM_Report_Form_Activity') {
    $permCustomGroupIds = [];
    $_customGroupExtends = $object->getVar('_customGroupExtends');
    $_customGroupExtends = array_merge($_customGroupExtends, [

    if (!CRM_Core_Permission::check('access all custom data')) {
      $allGroups = CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id');
      $permCustomGroupIds = CRM_ACL_API::group(CRM_Core_Permission::VIEW, NULL, 'civicrm_custom_group', $allGroups, NULL);
      // do not allow custom data for reports if user doesn't have
      // permission to access custom data.
      if (!empty($this->_customGroupExtends) && empty($permCustomGroupIds)) {
        $_customGroupExtends = [];
    $object->setVar('_customGroupExtends', $_customGroupExtends);
    $object->addCustomDataToColumns(TRUE, $permCustomGroupIds);

Your Answer

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

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