Is External ID Unique? will it automatically check for a duplicate External ID when the attempt is made to enter into database?
Can External ID be auto incremented whenever an individual gets added?
1 Answer
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 identifier of the contact that might originate in a separate system. In practice, it is most common to use it when migrating from some other CRM system into CiviCRM, wherein the other systems identifier is stored in the External ID. This can be invaluable for audit purposes.
If you are looking for an auto-incremented identifier, you should consider using the contact_id
.
-
thank you for the answer. For my organization, I want to store data of visitors, students, professors, scientists, members. While members have ID's in our previous system, others don't carry any such IDs. I am caught up between whether to use External ID to store the previous system ID or to create a custom field under civiMember? any suggestions? Commented Jun 17, 2017 at 3:41
-
Without knowing your particulars, I would suggest that you store the previous system ID in the External ID. That's really what it's for. Everything else should fit nicely into custom data sets I imagine. The only gotch is probably if you have different identification systems across the various originating data sources. Then, it usually helps to add a prefix to the external id to make it unique, but still auditable.– DaveDCommented Jun 19, 2017 at 12:58