so your aim is to let the end user change the external id directly?
It has several constraints (eg. it has to be unique) that made me wonder if you wouldn't be safer to create a custom field to store whatever you intend to put into the external id.
External id is a fairly technical field that I would not expose directly to the user, both to avoid ...
when you click in the QuickSearch (white search box very top left) you should see a drop down of 'what do i want to search for' and External ID is in there. So you can select that and then just enter the Ext ID that you are looking for.
You can also add the Ext ID field to a Profile which you have set up for Search or Listing if you want this more public eg ...
The External ID (external_identifier) is maintained in the database with a unique index, so any attempt to enter a duplicate value will take an error.
The external_identifier itself is simply a variable character string of 64 char in length (varchar(64)). As such it cannot auto-increment.
Remember, the external_identifier is designed to contain an ...
Thanks to Jamie McClelland, there is a patch available to make this more user-friendly. At some point hopefully it will be merged into core.
With this patch applied, instead of a fatal error, the import will continue and the problem rows will be ...
I would use the Contact Identity Extension and add a custom ID type for your membership number (https://github.com/systopia/de.systopia.identitytracker).
Fiddling around with contact ID's in the database could cause strange behaviour of your system because you have to check a lot of tables and changes something goes wrong are quite high.
Create an extension
The first step to create a hook is to create an extension.
I'd recommend installing civix which can generate an empty extension by simply typing the command :
civix generate:module myextension
Go check https://docs.civicrm.org/dev/en/latest/extensions/ for more details about extensions.
All you need to know for now is that civix will ...
I do not think there is a (good) way to use duplictae external IDs in CiviCRM - if you want to use the external ID field to do so. You could however create a custom field, import your external ID in that one and then adapt your matching rules to find duplicates (/civicrm/contact/deduperules?reset=1).
I originally wrote it that way to avoid confusion. If you want to pull up contact id 20 you'll be overwhelmed with irrelevant results (201, 202, 203, 120, 220, 320, and so on). You'll get so many results that the one you actually wanted might not even be in the list!
That said, if someone had time and/or money for the project, I'm sure there could be ...
I just ran into this very same issue today. I need to create/generate External IDs: First two digits of First Name + First two digits of Last Name + Date of Birth -> so e.g. COCR16091970