4

I have around 900 pairs of contacts I want to force merge. From my attempts to do this, if you click "merge all duplicates", it will simply display "900 pairs skipped" and not give you the "force batch merge" option that you do get when manually selecting contacts to merge.

I am matching on external id's that I've already rigged to ensure consistency, I am sure I want these merged.

Right now my only option is to select 100 contacts at a time and go through "batch merge", then "force batch merge" for each page.

How can I do this most easily?

1

2 Answers 2

5

I ran into a similar problem today. My solution requires some tech chops, but was very effective:

  • Install cv on the server if you haven't already.
  • Create a text file named forcemerge.php on the server anywhere in your webroot with the following contents:

<?php eval(`cv php:boot`); // Set the dedupe rule $rgid = 13; $return = CRM_Dedupe_Merger::batchMerge($rgid, NULL, 'aggressive', 1, 2, array(), FALSE);

  • Change the 13 above to the dedupe rule ID you want to use for deduping. You can also change the NULL to a group ID if you only want to dedupe a particular group.
  • Set that file as executable and run it!

You should be able to see your progress a number of ways, by periodically doing one of the following:

  • select count(*) from civicrm_contact WHERE is_deleted = 0; in a SQL client;
  • Finding duplicates through the CiviCRM UI and then pressing "Refresh Duplicates" to see the number decrease.
2

Using the "process_batch_merge" Scheduled Job is an easy option. Plus, you can schedule the job to run at an interval or use it as a one-time solution.

https://docs.civicrm.org/user/ca/latest/initial-set-up/scheduled-jobs/#job_process_batch_merge

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.