Answers.Body: <p>Create a simple extension implementing <a href="http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_buildForm" rel="nofollow">hook_civicrm_buildForm</a> like so:</p>
  
  <pre><code>function myextension_civicrm_buildForm($formName, &amp;$form) {
    if ($formName == 'CRM_Activity_Form_Activity' &amp;&amp; $form-&gt;getAction() == CRM_Core_Action::ADD) {
      $form-&gt;setDefaults(array('assignee_contact_id' =&gt; $form-&gt;_currentUserId));
    }
  }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-03T21:18:57.107Z
Answers.Text: Great Coleman, thanks so much. Will try creating it tonight.
Answers.UserDisplayName: Joe McLaughlin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-18T08:13:28.267Z
Answers.Text: 'action' needs to be changed to 'getaction'. In other words, $form->action  needs to be $form->getaction otherwise it throws an error.
Answers.UserDisplayName: OregonJohn
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-18T12:38:38.927Z
Answers.Text: Well I got you pretty close anyway. Have updated the answer (you can edit answers too!)
Answers.UserDisplayName: Coleman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-03T20:32:39.900Z
Answers.LastActivityDate: 2015-08-18T12:37:52.033Z
Answers.LastEditDate: 2015-08-18T12:37:52.033Z
Answers.UserDisplayName: Coleman
Answers.Body: <p>You can (must) use an extension.</p>
  
  <p>You can either use <code>hook_buildForm</code> to include a jQuery snippet that looks up the current user and populates the field, or you can use <code>hook_post</code> to do the same if there's no "Assigned to" set.  The first approach lets the user see the "Assigned To" with their name, but the second approach covers activities created via other means than the "New Activity" form (import, API, profiles, etc.).  If you go the second route, you need to make sure it's not assigning activities automatically for people contributing online etc.!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-03T20:27:20.923Z
Answers.Text: Jon G, thanks, so I'm writing a new extension to do this, right. Seems like hook_buildForm is the much safer route for my needs. Thanks so much.
Answers.UserDisplayName: Joe McLaughlin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-03T20:32:58.390Z
Answers.Text: I don't think you'll need jQuery. See my answer for example code.
Answers.UserDisplayName: Coleman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-03T19:57:50.837Z
Answers.LastActivityDate: 2015-08-03T19:57:50.837Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>Our users are creating many new Activities which are Assigned To the user creating the Activity. I want to save them time and keystrokes by having Assigned To: default to that logged-in user's name. How can I do this? Thanks. </p>
  
Tags: <contacts><activities>
Title: How can I set "Assigned To" for an Activity to default to the logged-in user name?
ThreadText: # How can I set "Assigned To" for an Activity to default to the logged-in user name?
  
  (Asked by: username_0 on 2015-08-03)
  
  Our users are creating many new Activities which are Assigned To the user creating the Activity. I want to save them time and keystrokes by having Assigned To: default to that logged-in user's name. How can I do this? Thanks.
  
  **Tags:** contacts, activities
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2015-08-03. Score: 5
  
  Create a simple extension implementing hook_civicrm_buildForm like so:
  function myextension_civicrm_buildForm($formName, &$form) {
    if ($formName == 'CRM_Activity_Form_Activity' && $form->getAction() == CRM_Core_Action::ADD) {
      $form->setDefaults(array('assignee_contact_id' => $form->_currentUserId));
    }
  }
  
  > **Comments:**
  > **username_0**: Great username_1, thanks so much. Will try creating it tonight.  
  > **username_2**: 'action' needs to be changed to 'getaction'. In other words, $form->action  needs to be $form->getaction otherwise it throws an error.  
  > **username_1**: Well I got you pretty close anyway. Have updated the answer (you can edit answers too!)  
  
  ---
  
  ### Answer by username_3 on 2015-08-03. Score: 3
  
  You can (must) use an extension.
  
  You can either use `hook_buildForm` to include a jQuery snippet that looks up the current user and populates the field, or you can use `hook_post` to do the same if there's no "Assigned to" set. The first approach lets the user see the "Assigned To" with their name, but the second approach covers activities created via other means than the "New Activity" form (import, API, profiles, etc.). If you go the second route, you need to make sure it's not assigning activities automatically for people contributing online etc.!
  
  > **Comments:**
  > **username_0**: Jon G, thanks, so I'm writing a new extension to do this, right. Seems like hook_buildForm is the much safer route for my needs. Thanks so much.  
  > **username_1**: I don't think you'll need jQuery. See my answer for example code.  
  
  ---
  
  