Can CiviCRM's internal contact ID be exposed in reports?
It doesn't look as though we can select it in the display columns listing for an activity report. (CiviCRM 4.5.8)
That's because the Activity report specifically hides the field in question.
Use one of the many methods of customization (PHP override directory, extension, etc.) to edit CRM/Report/Form/Activity.php
.
There's a separate column for the Source, Assignee, and Target contact IDs - find the stanza that looks like:
'contact_target_id' =>
array(
'name' => 'id',
'alias' => 'civicrm_contact_target',
'dbAlias' => "civicrm_contact_target.id",
'no_display' => TRUE,
'default' => TRUE,
'required' => TRUE,
),
Change it to be this:
'contact_target_id' => array(
'name' => 'id',
'alias' => 'civicrm_contact_target',
'dbAlias' => "civicrm_contact_target.id",
'title' => "Target ID",
'default' => TRUE,
),
Do that for the other two contacts and you're good.
Note that this may cause you to get a bunch of notices that alterDisplay isn't working correctly - this is changing the names of some variables that are used to turn contact names into links. You can ignore those notices if that functionality's not important - if it is, you may want to continue tweaking this a bit!