I would like to add multiple values in External ID. Is this possible or would I have to create a new custom field?
Example 2 Duplicate contacts have different external IDs. I want to merge them but keep both external ids.
Thanks
The External ID field isn't just a regular field--it allows matching by ID alone. It would be a waste to have External ID be concatenated fields, for a couple of reasons:
All in all, there's no advantage to cramming multiple values into the External ID field, and it has distinct disadvantages (merging and searching, in particular) as compared to regular custom fields. You should simply decide that one system's ID is the External ID and the others are custom fields. If it would be ambiguous, make them all custom fields; that's still better than mixing up the External ID field.
I believe the External ID is a single value field. On clicking help you'll see: "Use this field to store a unique identifier. This is generally used to link contacts with records in a related or legacy application...."
As you suggested a custom field might be needed, perhaps you can use a multi-value custom field, and move all your external ids to this new custom field.
If you don't have a lot of these - simply add the second External ID to the merged record manually, and separate the values with a non-numeric character like - or | - then you can search using Search Builder or in the back end (using PHPMyAdmin) or in the API Explorer for values with - or |, and/or use the % "wild card" in searches, like %[second External ID value]%. This assumes the External ID field doesn't allow only numeric values but any text string - I'm not sure about that.
If you do have a lot of these - export the current and deleted/merged records as .csv, match up the two sets of records by first name and last name, say, then concatenate the values of the two External IDs into a new column/field using that function in Excel, Google Sheets, or with a query using MS Access, MySQL, whatever. Then import and update the External IDs for the records that you are keeping, matching on import using the kept record's Internal Contact ID, Civi's unique ID for that person.
It all depends on what you plan on doing with the External ID. Its suggested use is to use it to match on imported contributions and other transactional data. If that's your use case, then a single value probably makes the most sense.
It's also useful for just referencing back to some prior legacy data. Here a single value probably makes the most sense, though on a manual basis multiple values would probably work using delimiters as outlined in other answers.
Interestingly, if you are doing custom development (and I don't know why you wouldn't use a custom data field for it) you can put anything in the External ID field. For instance on the CiviCRM sandbox I was able to enter in a bit of json formatted values which could be used programmatically. (JSON is a standard for formatting data values, ie {"source": "sheet12","row": "22"}
. This example might be used to reference back to a row in a spreadsheet.)