Answers.Body: <p>There are a couple of ways to do this:</p>
  
  <ul>
  <li>When creating an activity, add the Organization as a related contact.</li>
  <li>Create an extension to automate adding the Organization (see below).</li>
  <li>Create a custom report (not recommended).</li>
  </ul>
  
  <p>As extensions go, it's pretty easy to write:</p>
  
  <ul>
  <li>use the <code>hook_civicrm_pre</code> to hook created activities.  </li>
  <li>Use an API call to look up the contact.  Is the <code>contact_type</code> equal to <code>Individual</code>? Is the <code>employer_id</code> not null?</li>
  <li>If so, add the employer as a related contact.</li>
  </ul>
  
  <p>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.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-03T11:04:45.797Z
Answers.Text: 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.
Answers.UserDisplayName: Cowcross
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-03T16:59:08.370Z
Answers.Text: 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 https://chat.civicrm.org in ~dev-newcomers to help get your extension-writing environment set up!
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-02T17:41:39.887Z
Answers.LastActivityDate: 2018-01-02T17:41:39.887Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>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?</p>
  
  <p>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. </p>
  
  <p>Or would I have to create a custom report for this?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-03T21:06:36.577Z
Comments.Text: 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
Comments.UserDisplayName: petednz - fuzion
Tags: <civievent><activities>
Title: Adding individuals' event attendance as activity for employer?
ThreadText: # Adding individuals' event attendance as activity for employer?
  
  (Asked by: username_0 on 2018-01-02)
  
  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?
  
  **Tags:** civievent, activities
  
  > **Comments:**
  > **username_1**: 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  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-01-02. Score: 4
  
  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.
  
  > **Comments:**
  > **username_0**: 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.  
  > **username_2**: 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 https://chat.civicrm.org in ~dev-newcomers to help get your extension-writing environment set up!  
  
  ---
  
  