merge contact

Ivan Louw asked on May 10, 2019 08:50

Hi,

I am using Kentico 12 MVC.

Is there an example to over write the class that merges contact, I need to expand the basis it use to merge contacts.

Thanks for any information.

Recent Answers


Dmitry Bastron answered on May 12, 2019 21:27

Hi Ivan,

It is not customizable as per my knowledge. But recognizing contacts on the site is customizable, please refer to this guide.

If you could tell more about your task, maybe there are some other ways of doing this?

0 votesVote for this answer Mark as a Correct answer

Ivan Louw answered on May 13, 2019 04:30

Hi Dmitry,

Our business can have multiple contacts with same email address, for example husband and wife can be a separate contact but they may have same email address.

By default Kentico will merge contacts if email id of two contacts are same. Is it possible to define merge rules in Kentico? We do not want to merge contacts if only email ids are same. We want to merge contact if last name, email and mobile matches.

Below is the api link I am looking at, is it possible in Kentico 12 MVC, I can't see any option to configure merger rules.

http://devnet.kentico.com/docs/12_0/api/html/M_CMS_ContactManagement_IContactMergeService_MergeContactByEmail.htm IContactMergeService.MergeContactByEmail Method devnet.kentico.com Tries to merge given by . Moves subscriptions and copies contact's data. In the case the EMS license is available, moves activities, memberships, relations and copies contact's data. Given will be used as merge target, i.e.

0 votesVote for this answer Mark as a Correct answer

Dmitry Bastron answered on May 13, 2019 12:06

Well, it doesn't look too easy =)

What you gonna do then is:

Implement your contact merging code. You can't just inherit from ContactMergeService (and this I think is a kind of indicator from Kentico team it is not a recommended way). You would also need to decompile and move implementation of IContactMergeOnlineUsersUpdater interface as it is internal.

public class CustomContactMergeService : IContactMergeService
{
    // use decompiled implementation of ContactMergeService
    // and add your logic to MergeContactByEmail method
}

Register this implementation on startup (I'm not sure it's needed for CMS project but I would do it for both CMS and MVC)

CMS.Core.Service.Use<IContactMergeService>(new CustomContactMergeService());

BUT

There is a potential problem with this method

ContactInfoProvider.GetContactInfo(email);

as I think it would return first of your duplicated contacts and you should be aware of it. So potentially if you use email marketing and Kentico might be using this method for sending emails chances are you will have only one email sent for 2 contacts with the same email address using first found contact name.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.