Body: <p>I had a glitch in a script that caused some unwanted contact merges to happen programmatically:</p>
  <pre><code>$result = civicrm_api3('Contact', 'merge', [ 'to_remove_id' =&gt; $existingContactId, 'to_keep_id' =&gt; $contactId, 'mode' =&gt; &quot;aggressive&quot;,]);
  </code></pre>
  <p>Fortunately, I had the Detailed Logging setting enabled. In theory, I could pull the change log for each unwanted merge and &quot;revert&quot; the merge. Does anyone know of an extension or script I can look at to accomplish this?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-08-11T20:11:06.410Z
Comments.Text: There is an answer here which says you should be able to do this via the Change Log - but I just gave this a whirl on dmaster and did not find any options to do so. https://civicrm.stackexchange.com/questions/41703/is-it-possible-to-unmerge-two-contacts
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-08-11T20:50:03.680Z
Comments.Text: It's there. See the button at the bottom here. https://dmaster.demo.civicrm.org/civicrm/report/instance/37?reset=1&log_conn_id=62f56b07098c77G1t&cid=206&oid=207&alteredName=Aaa%20Bbb%20[Contact%20Merged]&cid=206&alteredBy=demo@example.com&alteredById=204&section=2. To get there click on the change log tab for https://dmaster.demo.civicrm.org/civicrm/contact/view?reset=1&cid=206, then drill down on the Contact Merge entry.
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-08-12T20:11:12.507Z
Comments.Text: hmm that link isn't working for me, even if i try just going to civicrm/report/instance/37?reset=1 without the contact IDs in it. I tried merging another couple of contacts but still not getting any results. was report=37 one you created? what is the basis of the report? or perhaps you could expand on your comment as an Answer with s'shots?
Comments.UserDisplayName: petednz - fuzion
Tags: <wordpress><extension><duplicate-contacts>
Title: Is it possible with "Detailed Logging" enabled to perform a revert of a contact merge?
ThreadText: # Is it possible with "Detailed Logging" enabled to perform a revert of a contact merge?
  
  (Asked by: username_0 on 2022-08-11)
  
  I had a glitch in a script that caused some unwanted contact merges to happen programmatically:
  $result = civicrm_api3('Contact', 'merge', [ 'to_remove_id' => $existingContactId, 'to_keep_id' => $contactId, 'mode' => "aggressive",]);
  
  Fortunately, I had the Detailed Logging setting enabled. In theory, I could pull the change log for each unwanted merge and "revert" the merge. Does anyone know of an extension or script I can look at to accomplish this?
  
  **Tags:** wordpress, extension, duplicate-contacts
  
  > **Comments:**
  > **username_1**: There is an answer here which says you should be able to do this via the Change Log - but I just gave this a whirl on dmaster and did not find any options to do so. https://civicrm.stackexchange.com/questions/41703/is-it-possible-to-unmerge-two-contacts  
  > **username_2**: It's there. See the button at the bottom here. https://dmaster.demo.civicrm.org/civicrm/report/instance/37?reset=1&log_conn_id=62f56b07098c77G1t&cid=206&oid=207&alteredName=Aaa%20Bbb%20[Contact%20Merged]&cid=206&alteredBy=demo@example.com&alteredById=204&section=2. To get there click on the change log tab for https://dmaster.demo.civicrm.org/civicrm/contact/view?reset=1&cid=206, then drill down on the Contact Merge entry.  
  > **username_1**: hmm that link isn't working for me, even if i try just going to civicrm/report/instance/37?reset=1 without the contact IDs in it. I tried merging another couple of contacts but still not getting any results. was report=37 one you created? what is the basis of the report? or perhaps you could expand on your comment as an Answer with s'shots?  
  
  ---
  
  ## 0 answers
  
  