Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Answered

Custom duplication rule with plugin

(0) ShareShare
ReportReport
Posted on by 1,229

Hi,

I had a requirement to create custom duplication rule using plugin.Is that possible to display the screen below if there is duplication record detected by the plugin?

duplicate-record-screen.jpg

Thanks.

Regards,

Teh

  • Venedict Profile Picture
    Venedict 1,229 on at
    RE: Custom duplication rule with plugin

    Hi Clofly,

    It is working with data import now.

    Thanks for your help.

    Regards,

    Teh

  • Venedict Profile Picture
    Venedict 1,229 on at
    RE: Custom duplication rule with plugin

    Hi Clofly,

    Noted. I just open a new thread.

    Regards,

    Teh

  • cloflyMao Profile Picture
    cloflyMao 25,202 on at
    RE: Custom duplication rule with plugin

    Hi Teh,

    Ok, I'll wait for your feedback.

    If you had another question, please kindly open a new thread, thanks.

    You could create a static function to remove accents from fullname field value with .NET Normalize library.

    https://stackoverflow.com/questions/2393887/how-to-replace-special-characters-with-their-equivalent-such-as-%C3%A1-for-a/

    https://stackoverflow.com/questions/249087/how-do-i-remove-diacritics-accents-from-a-string-in-net

    Regards,

    Clofly

  • Venedict Profile Picture
    Venedict 1,229 on at
    RE: Custom duplication rule with plugin

    Hi Clofly,

    Thanks for your help. I will try out later.

    Now I had another problem, but also on duplication rule. My customer have some contact is stored in foreign language accents like José Gutiérrez, but when user try to create a new contact with Jose Gutierrez. Is there any way to detect it as duplication?

    I tested using standard rule, it seem consider it as 2 separate records.

    Thanks.

    Regards,
    Teh

  • Verified answer
    cloflyMao Profile Picture
    cloflyMao 25,202 on at
    RE: Custom duplication rule with plugin

    Hi Teh,

    That because during data import process, context depth equals 2.(depth: How many times the plugin is firing based on certain events)

    Here is a thread to make us understand the concept.

    In my original block, it's

    if (context.Depth > 1)
    {
        return;
    }

    Thus checking code will be passed.

    So I changed the block to:

    if (context.Depth > 2)
    {
        tracingService.Trace("Context depth is: {0}", context.Depth);
        return;
    }

    Now it'll work for both creating record in form and data import process, and infinite loops will still be prevented.

    Existing lead record:

    pastedimage1585298430575v2.png

    Data in excel:

    pastedimage1585298484464v3.png

    Error during data import process:

    pastedimage1585298405327v1.png

    What'more, the stage of execution should be PreValidation.

    pastedimage1585298269723v2.png

    Regards,

    Clofly

  • cloflyMao Profile Picture
    cloflyMao 25,202 on at
    RE: Custom duplication rule with plugin

    Hi Teh,

    I have tested the function, and also encountered your issue.

    I'm trying to find a solution to handle it.

    Regards,

    Clofly

  • Venedict Profile Picture
    Venedict 1,229 on at
    RE: Custom duplication rule with plugin

    Hi Clofly,

    Are you able to test the data import function?

    Thanks.

    Regards,

    Teh

  • Venedict Profile Picture
    Venedict 1,229 on at
    RE: Custom duplication rule with plugin

    Hi Clofly,

    Thanks for your prompt reply. I would prefer plugin instead of javascript, as javascript looks a little bit complex to me compare to sdk.

    Thanks.

    Regards,

    Teh

  • cloflyMao Profile Picture
    cloflyMao 25,202 on at
    RE: Custom duplication rule with plugin

    Hi Teh,

    Thanks for your feedback.

    I got off work now, I'll test it for you tomorrow.

    In addition, would you like to do it with javascript?

    Regards,

    Clofly

  • Venedict Profile Picture
    Venedict 1,229 on at
    RE: Custom duplication rule with plugin

    Hi Clofly,

    I was trying to use your sample code in the 2nd post to create a custom plugin and check again contact entity for duplicate record.

    I noticed that if I manual create/update record, it will prompt the error. But when I try to data import function, it seem the plugin is not working. The plugin I just check the lastname column.

    In my past experience, the plugin should triggered regardless the data was create/update through the form itself or csv file import.

    Can you test do you experience the same thing for data import in marketing app? 

    Thanks.

    Regads,
    Teh

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,074 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,900 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans