Using external identifier deduping rules to update contacts
When data is imported to update contacts, CiviCRM has a set of rules to match contacts already in the database. By default, CiviCRM uses the e-mail address. If it finds a matching e-mail address it will update the matching contact. A problem will arise because not all of your contacts will have an e-mail address. So if we try to import some updates, only those contacts with an e-mail address will be updated.
In these situations we need to have a different unique identifier that we can let CiviCRM use to match records.
How to do it…
We will use the External Identifier field in CiviCRM as our unique identifier. This field has to have a unique value for each contact. This will provide us with a good alternative to e-mail addresses to match contact data.
- Navigate to Contacts | Find and Merge Duplicate Contacts.
The screenshot shows the deduping rules that are available to use for each contact type:
If we were importing data for individuals then CiviCRM would use the Email (reserved) rule that matches on e-mail addresses. So we need a different unique identifier for each contact that we can use instead of the e-mail address.
Quite often legacy data will already have a unique identifier, such as a client ID or membership number. If you already have an existing unique identifier then it is a good idea to have mapped this to CiviCRM's External Identifier field when your data is first imported.
If you do not have a unique identifier, then you can construct one using Google Refine.
- Click on Add Rule. The following screenshot is what you will find:
- Give the rule a name. Here we used Custom import.
- Select Unsupervised for Usage. Unsupervised rules are used for imports and entries through online forms such as event signups or contact information using profiles. Supervised rules are used when user information is added manually through the contact screen.
- Enter the external identifier as the first matching field with a weight of 10. Make the weight threshold to trigger the rule at 10. That's it. You can now use this rule to match contacts when you are importing data.
See also
- The Using Google Refine to create a unique ID recipe
- Find out more about CiviCRM deduping and merging at http://book.civicrm.org/user/current/common-workflows/deduping-and-merging/