We frequently try to match facebook event attendees to contacts in our database in order to send targeted emails to the person. By matching them to our database we know a lot more about the people (e.g. geolocation to include reference to an elected representative). The process in civi to do this is cumbersome. We take the list of people from facebook (names only) and assign an external ID, then import the list to civi. We assume that names are unique (a somewhat reasonable assumption for our database). Following this process we want to free up the contact's external ID field to allow the next import to run without having to manually de-dupe anyone who has an external ID previously set. How can we either:

  1. Do this without external IDs

  2. Reset the external ID to null

We are using wordpress 4.4.1 and civi 4.6.10

  • I just looked at the fix queue - is it possible that upgrading to 4.6.11 will allow dedupe to work, overwriting old externalid values?
    – Ben
    Commented Jan 14, 2016 at 21:08

2 Answers 2


If you have sql access, it's a very simple update query

update civicrm_contact c
set    c.external_identifier = null
where  c.external_identifier is not null

This, of course, will null all of them for all contacts but I think that is what you're asking for.

  • Ok - this looks like it will do it, so I will ask our DBA to run this. I presume this won't affect the database negatively? As in, Civi does not depend on the ID on an ongoing basis once the contact is assigned to an event?
    – Ben
    Commented Jan 15, 2016 at 12:58
  • 1
    @Ben - That's correct. External ID isn't used by Civi for anything. Commented Jan 15, 2016 at 14:32

You could do a batch update via profiles see CiviCRM user and administrator guide.

I just tried it and it only took a couple of minutes to set the profile up. You only need one field for External Contact Id. In a nutshell, once you set up the profile, you query up the contacts you wish to change, select Batch Update via Profile, select the profile. Then you can null out the first record click on the copy icon and it nulls out all the rest.

One caveat is you can only batch update one contact type at a time so you if you have both households and individuals you'll need to do the query twice.

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.