4

I've imported our membership list with existing membership numbers into CiviCRM.

The old membership numbers are currently under external ID. I'd like an autoincrementing membership number.

The best solution I have found from digging around various threads and forums is to do the following in order to use the contact id as the membership:

  • Modify the database schema constraints to allow updating the contact id and to propagate those changes to all tables
  • execute a script that would update the contact id to be the same as the member external id

I might be able to figure out the second part given enough time, but the first bit for sure is a bit beyond my SQL skills. Is anybody able to assist? Or there a better solution available to what I imagine is a common requirement?

  • Are you trying to match external number with membership or trying to set auto increment with the membership table ? – Ramesh - ARTECH Consultancy Aug 25 '18 at 6:55
  • if I could do both that would be good. although the intitial idea above did neither - it just put replaced exisitng contact ids with the external ids and then relies on the contact id to autoincrement. – dgk112 Aug 28 '18 at 13:09
2

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.

  • thanks Jaap - not much info for the Contact Identity extension as far as I can see. what does it do please? – dgk112 Aug 28 '18 at 13:06
  • It keeps a list of the contact identity numbers of your contact. Even after merging a contact, so that those identity numbers. Conceptual your membership number gets more or less static with the record in the system but more static with the person. – Jaap Jansma - CiviCooP Aug 29 '18 at 8:12
  • does it autoincrment each time a new contact is created? – dgk112 Aug 30 '18 at 16:49
  • No it doesnt do that, it just stores the numbers and keeps track of them. In fact the Contact ID is also stored in the history. – Jaap Jansma - CiviCooP Aug 31 '18 at 11:24
0

My solution was to make the contact id match the old membership numbers for all the contacts that I imported and then just rely on auto increment of contact id for new members. Of course there will be gaps in the membership numbers for new contacts but that isn't an issue for me.

You need to start with a new system, so that only contact ids 1 & 2 are already in use (I didn't still have these old membership numbers in use fortunately). Before you import the records, you will need to create dummy records for any gaps in your list of membership numbers and identify them so you can easily find and delete them after the import. You need to have the records in order of old membership number for import.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.