Answers.Body: <p>This is now logged with a patch here <a href="https://issues.civicrm.org/jira/browse/CRM-18307" rel="nofollow">https://issues.civicrm.org/jira/browse/CRM-18307</a></p>
  
  <p>However if you are experiencing this I suggest you give serious consideration to enabling 'Contact Trash and Undelete' per Cullen McGough Mar 25 at 20:39 - since that setting is the default and for most sites having the delete to trash option turned on is a sensible precaution</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-28T22:42:10.173Z
Answers.LastActivityDate: 2016-03-28T22:42:10.173Z
Answers.UserDisplayName: Eileen
Answers.Body: <p>This is happening as a result of <a href="https://issues.civicrm.org/jira/browse/CRM-18106" rel="nofollow">CRM-18106</a>, "Add activity to deleted contacts showing they were deleted by merge".  I added a comment to that issue referencing this question.  In short: In Civi 4.7.4, this activity is added to contacts deleted by merge - part of a larger effort to make deduping reversible.  It's not working for you.  That's unfortunate - but the good news is that what's broken didn't exist before 4.7.4, so you shouldn't be experiencing any ill effects other than the error.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-25T17:36:48.760Z
Answers.LastActivityDate: 2016-03-25T17:36:48.760Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.Body: <p>shot in the dark... any external ID's?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-25T17:22:39.993Z
Answers.LastActivityDate: 2016-03-25T17:22:39.993Z
Answers.UserDisplayName: Leslie Dugger
Answers.Body: <p>Ah - if the contact id doesn't exist perhaps delete to trash is off?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-25T20:39:59.290Z
Answers.Text: We have a winner. Setting "Contact Trash and Undelete" in Administer > Misc (Undelete, PDFs, Limits, Logging, Captcha, etc.) fixes this behavior.
Answers.UserDisplayName: Cullen McGough
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-25T20:07:31.660Z
Answers.LastActivityDate: 2016-03-25T20:07:31.660Z
Answers.UserDisplayName: eileen
Body: <p>Drupal 7, Civicrm 4.7.4</p>
  
  <p>I'm getting this error message after every contact merge. Any ideas?</p>
  
  <hr>
  
  <h2>debug message</h2>
  
  <pre><code>CiviCRM_API3_Exception: "Invalid Contact Id"
  
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/CRM/Dedupe/Merger.php(1945): civicrm_api3("activity", "create", (Array:5))
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/CRM/Dedupe/Merger.php(1834): CRM_Dedupe_Merger::createMergeActivities("55836", "197792")
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/CRM/Contact/Form/Merge.php(318): CRM_Dedupe_Merger::moveAllBelongings("55836", "197792", (Array:35))
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/CRM/Core/Form.php(423): CRM_Contact_Form_Merge-&gt;postProcess()
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/CRM/Core/StateMachine.php(160): CRM_Core_Form-&gt;mainProcess()
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Next.php(61): CRM_Core_StateMachine-&gt;perform(Object(CRM_Contact_Form_Merge), "next", "Next")
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next-&gt;perform(Object(CRM_Contact_Form_Merge), "next")
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller-&gt;handle(Object(CRM_Contact_Form_Merge), "next")
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page-&gt;handle("next")
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/CRM/Utils/Wrapper.php(113): CRM_Core_Controller-&gt;run()
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/CRM/Core/Invoke.php(286): CRM_Utils_Wrapper-&gt;run("CRM_Contact_Form_Merge", "Merge Contact", NULL)
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:13))
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:3))
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/drupal/civicrm.module(454): CRM_Core_Invoke::invoke((Array:3))
   [internal function](): civicrm_invoke("contact", "merge")
   /var/www/vhosts/example.com/httpdocs/includes/menu.inc(527): call_user_func_array("civicrm_invoke", (Array:2))
   /var/www/vhosts/example.com/httpdocs/index.php(21): menu_execute_active_handler()
   {main}
   Sorry but we are not able to provide this at the moment.
  Invalid Contact Id
  </code></pre>
  
Tags: <contacts><issues><duplicate-contacts>
Title: "Invalid Contact ID" displayed after merge?
ThreadText: # "Invalid Contact ID" displayed after merge?
  
  (Asked by: username_0 on 2016-03-25)
  
  Drupal 7, Civicrm 4.7.4
  
  I'm getting this error message after every contact merge. Any ideas?
  
  ---
  
  ## debug message
  
  ```
  CiviCRM_API3_Exception: "Invalid Contact Id"
  
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/CRM/Dedupe/Merger.php(1945): civicrm_api3("activity", "create", (Array:5))
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/CRM/Dedupe/Merger.php(1834): CRM_Dedupe_Merger::createMergeActivities("55836", "197792")
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/CRM/Contact/Form/Merge.php(318): CRM_Dedupe_Merger::moveAllBelongings("55836", "197792", (Array:35))
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/CRM/Core/Form.php(423): CRM_Contact_Form_Merge->postProcess()
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/CRM/Core/StateMachine.php(160): CRM_Core_Form->mainProcess()
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Next.php(61): CRM_Core_StateMachine->perform(Object(CRM_Contact_Form_Merge), "next", "Next")
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Contact_Form_Merge), "next")
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contact_Form_Merge), "next")
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page->handle("next")
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/CRM/Utils/Wrapper.php(113): CRM_Core_Controller->run()
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/CRM/Core/Invoke.php(286): CRM_Utils_Wrapper->run("CRM_Contact_Form_Merge", "Merge Contact", NULL)
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:13))
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:3))
   /var/www/vhosts/example.com/httpdocs/sites/all/modules/civicrm/drupal/civicrm.module(454): CRM_Core_Invoke::invoke((Array:3))
   [internal function](): civicrm_invoke("contact", "merge")
   /var/www/vhosts/example.com/httpdocs/includes/menu.inc(527): call_user_func_array("civicrm_invoke", (Array:2))
   /var/www/vhosts/example.com/httpdocs/index.php(21): menu_execute_active_handler()
   {main}
   Sorry but we are not able to provide this at the moment.
  Invalid Contact Id
  
  ```
  
  **Tags:** contacts, issues, duplicate-contacts
  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_4 on 2016-03-25. Score: 3 | Accepted answer
  
  Ah - if the contact id doesn't exist perhaps delete to trash is off?
  
  > **Comments:**
  > **username_0**: We have a winner. Setting "Contact Trash and Undelete" in Administer > Misc (Undelete, PDFs, Limits, Logging, Captcha, etc.) fixes this behavior.  
  
  ---
  
  ### Answer by username_1 on 2016-03-28. Score: 1
  
  This is now logged with a patch here <https://issues.civicrm.org/jira/browse/CRM-18307>
  
  However if you are experiencing this I suggest you give serious consideration to enabling 'Contact Trash and Undelete' per username_0 Mar 25 at 20:39 - since that setting is the default and for most sites having the delete to trash option turned on is a sensible precaution
  
  
  ---
  
  ### Answer by username_2 on 2016-03-25. Score: 1
  
  This is happening as a result of [CRM-18106](https://issues.civicrm.org/jira/browse/CRM-18106), "Add activity to deleted contacts showing they were deleted by merge". I added a comment to that issue referencing this question. In short: In Civi 4.7.4, this activity is added to contacts deleted by merge - part of a larger effort to make deduping reversible. It's not working for you. That's unfortunate - but the good news is that what's broken didn't exist before 4.7.4, so you shouldn't be experiencing any ill effects other than the error.
  
  
  ---
  
  ### Answer by username_3 on 2016-03-25. Score: -1
  
  shot in the dark... any external ID's?
  
  
  ---
  
  