I need to do a de-dupe on a set of records. Two groups were brought in with different External ID's for each contact. I need to merge the contacts, but export the External ID that was kept and the External ID that was dropped. Having the First Name/Last Name would be bonus. This way, when I bring in additional data linked to an external ID, I can pre-write the corrected existing external ID from the map.

Contact A has an External ID of 123. Contact B has an External ID of 456. Contact A and B are the same person, but has two different External ID's from separate systems. I need to create a mapping, an exported CSV file, that maps 456 to 123, so that when I later bring in Note C related to Contact B via External ID 456, I can re-write the External ID to 123 and have Note C imported to Contact A with External ID 123.

Unfortunately, I don't see any kind of Export on the de-duping pages. I'm hoping that I am just missing it. Any ideas how one might accomplish such a task without going line by line and copy/pasting to an Excel file? (We're talking thousands here.)

Clear as mud yet?

Wordpress 4.5.3, CiviCRM 4.7.8 (Yes, I'm aware of the current de-dup flipping bug that is being fixed in 4.7.9.)

1 Answer 1


You will not be able to do that with the GUI since it lists the matched pairs but does not allow to export it in a configurable way.

Your best bet will be to use the API (that means programming in PHP), and specifically the entity Contact, action duplicatecheck. Here is a sample code:

$result = civicrm_api3('Contact', 'duplicatecheck', array(
  'sequential' => 1,
  'dedupe_rule_id' => 4,

This will return a list of matched contact pairs with the dedupe rule 4.

  • Sounds like a very useful addition, especially for those that do it all the time, to export a CSV at the end of the batch processing. Beyond where I am programming wise, but seems like a logical step to the new merge capabilities.
    – G H
    Commented Jun 23, 2016 at 14:30
  • It seems like there isn't quite enough here to return the list. There seems to be get statement that is necessary also. I've yet to see it working correctly, via the API Explorer.
    – G H
    Commented Nov 28, 2016 at 15:23

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.