+ Start a Discussion
ADC Test UserADC Test User 

Detecting Contact Mergers via API

Hi -

I need to do some special processing on our system when a contact gets merged into another contact.

Currently, I have no way of detecting that a merge has taken place via the API.  We are being notified the deletion of the contact who did not survive the merge (via the getDeleted() call), and (via the getUpdated() call) we are being notified of an update of the contact who did survive, but I can see no way of knowing that an actual merge has taken place, nor can I associate the deleted contact's id to the surviving contact's id.  Is there any way of doing this?



Jeff Podlogar






Hi ADC Test User,

I don't see any way to detect that a contact is the result of merging two or more contacts either.  The only thing that I can come up with is implied logic.  It appears that the deleted timestamp is the same as the SystemModstamp on the updated record to the second.

If the deleted record is a contact and there is an updated contact record with the same timestamp (to the second) then the contact update was the result of a merge.

Not perfect, but may do the trick.

I'm wondering if anyone has come up with a more elegant solution to this as I will be needing to accomplish the same thing.


I'm struggling with the same issue. Using SystemModstamp doesn't sound error-free. Is there a more thorough solution to this problem yet? How can I obtain the final merged contact id for a given contact using its old id?

Thanks in advance.

With API 8.0, object types that support merge have a new masterRecordId field, for records that have been merged this will contain the id of the record it was merged into. You'll need to use the new queryAll method to access the merged records., e.g.

queryAll("Select id, masterRecordId from contact where MasterRecordId != null")
This is exactly what I needed. Thanks so much Simon.