1

Request your support.

I have two contacts with same email id and different source identifier. I want to perform mergeContacts() operation on these two contacts. I am using standard xConnect API.

client.MergeContacts(SourceContact, TargetContact);

I see merge operation is getting successful but I don't see facet data is copied from SourceContact to TargetContact.

Source & Target contact has one marketing preference each. I am expecting two marketing preferences on Target contact once merge get succeeded.

Thanks Hari

1 Answer 1

1

That's expected behavior.

When you call client.MergeContacts it will copy facets from Source contact to Target Contact, but it will not merge any facets.

ExmKeyBehaviorCache facet contains a list of MarketingPreference objects. When you merge, it will just copy the whole ExmKeyBehaviorCache facet. It will not merge lists of marketing preferences from ExmKeyBehaviorCache source contact facet with ExmKeyBehaviorCache target contact facet.


EDIT

Here is the information from Sitecore documentation ( https://doc.sitecore.com/xp/en/developers/103/sitecore-experience-platform/merge-contacts.html ):

All value facets are copied from the source contact to the target contact except when the facet already exists on the target contact. For example, if the target contact already has PersonalInformation facet, it will not be overridden by the source contact’s PersonalInformation facet.

Note

Experience Optimization’s TestCombinations facet behaves differently - if an anonymous contact was exposed to a test combination and then identifies themselves partway through the session, the known contact’s test combinations facet will be overwritten.

Calculated facet merge handlers are executed.

And another part:

Custom merge handlers

You must create a calculated facet merge handler for calculated facets, as they may required custom merge logic. Value facets are merged automatically. However, you can create a merge handler for a value facet if that facet requires custom merge logic.

https://doc.sitecore.com/xp/en/developers/103/sitecore-experience-platform/create-a-facet-merge-handler.html

2
  • Thanks Marek for your answer. I am surprised that its expected behaviour. If Target contact has ExmKeyBehaviorCache facet, Would it still copy the ExmKeyBehaviorCache from Source contact? or Would it only copy if Target contact does not have ExmKeyBehaviorCache facet? Oct 13, 2023 at 3:55
  • 1
    @HariWaghamare see updated answer
    – Marek Musielak
    Oct 13, 2023 at 6:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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