Is it possible to set up Civi so that when an individual attends an event, it also shows up as an activity for their employer?

I'd like to be able to get an overview of how many people from an organisation attended (or spoke at) events alongside the other meetings, phonecalls, etc attached to that organisation's Activities.

Or would I have to create a custom report for this?

  • if signing up for the event could be done via Drupal webform_civicrm then i think this could all be achieved in the webform, but appreciate that is quite a switch
    – petednz - fuzion
    Commented Jan 3, 2018 at 21:06

1 Answer 1


There are a couple of ways to do this:

  • When creating an activity, add the Organization as a related contact.
  • Create an extension to automate adding the Organization (see below).
  • Create a custom report (not recommended).

As extensions go, it's pretty easy to write:

  • use the hook_civicrm_pre to hook created activities.
  • Use an API call to look up the contact. Is the contact_type equal to Individual? Is the employer_id not null?
  • If so, add the employer as a related contact.

You'll have to consider edge cases: What happens if someone leaves an organization - does their attendance still count? If someone joins an organization after the activity, does that count? A custom report limits your ability to handle edge cases any way other than a "default" way, which is why it's not usually recommended.

  • Hi Jon G, thanks for your response. The first option doesn't apply, as I want this to happen when I add people to an event rather than adding an activity. I've not got any experience writing extensions, but will look into it - thanks for the tips on edge cases.
    – Cowcross
    Commented Jan 3, 2018 at 11:04
  • In that case - you'll probably want to create a new activity type to capture this. You don't want to clone anything that could screw up your participant counts etc. Come find me (and others) on chat.civicrm.org in ~dev-newcomers to help get your extension-writing environment set up! Commented Jan 3, 2018 at 16:59

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.