2

I have two instances of CiviCRM, not all the CiviCRM ID's match. How can i get the contacts on both databases to have the same CiviCRM ID (ie CiviCRM ID of contact A in db1 = CiviCRM ID of contact A in db2)?. The use case is as follows:

I have two civi dbs (I will refer to them as A and B, and they are not in sync), B is a copy of A, A is open to public for events registration, B is restricted only to internal network and is used for projects. Data in B is seen as more up to date and reliable because it is entered by staff. I don't want to sync B to A because they have unrelated activities. I want to pull data from A for reporting and if some fields are empty in A (e.g. date of birth), get this data from B if CiviCRM ID A = CiviCRM ID B

  • Would help folks give a better answer if you can describe your use case and why you desire the above feature – Donald Lobo Jun 1 '15 at 16:27
  • Thanks Lobo, I will try to explain as much as i can. I have two civi dbs (I will refer to them as A and B, and they are not in sync), B is a copy of A, A is open to public for events registration, B is restricted only to internal network and is used for projects. Data in B is seen as more up to date and reliable because it is entered by staff. I don't want to sync B to A because they have unrelated activities. I want to pull data from A for reporting and if some fields are empty in A (e.g. date of birth), get this data from B if CiviCRM ID A = CiviCRM ID B. – Kboy Jun 1 '15 at 19:46
  • I incorporated the comment into the question – Donald Lobo Jun 1 '15 at 20:00
5

Depending on your end goal, one solution is to set the External ID of a record in instance B, to the Internal ID from instance A.

The Internal ID (civicrm_contact.id) is a primary key; the database engine assigns that field, and you risk data corruption by trying to keep it in sync yourself. The reliable way to keep them in sync is to have instance B act as a Replication Slave of instance A, where data changes in A are copied to B (but not vice versa).

If you can tell us more about what you are actually trying to achieve (as a new question), perhaps we can help you with the greater goal.

0

Agree with Nicholai. Another option might be to create a custom group with a field that holds the key in the 'other' CiviCRM? We have used that to sync with another package. But more detail might help? Should the CiviCRM ID's be the same on both installations or should you be able to sync? Does make a difference...

  • I do not want to sync, the CiviCRM ID's should be the same on both installations. I think i'm going with Nicholai's idea, the external ID of B should be equal to the CiviCRM ID of A. – Kboy Jun 3 '15 at 13:01

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.