web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Custom duplication rule with plugin

(0) ShareShare
ReportReport
Posted on by 1,235

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

I have the same question (0)
  • Venedict Profile Picture
    1,235 on at

    Hi Clofly,

    It is working with data import now.

    Thanks for your help.

    Regards,

    Teh

  • Venedict Profile Picture
    1,235 on at

    Hi Clofly,

    Noted. I just open a new thread.

    Regards,

    Teh

  • cloflyMao Profile Picture
    25,210 on at

    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
    1,235 on at

    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
    25,210 on at

    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
    25,210 on at

    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
    1,235 on at

    Hi Clofly,

    Are you able to test the data import function?

    Thanks.

    Regards,

    Teh

  • Venedict Profile Picture
    1,235 on at

    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
    25,210 on at

    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
    1,235 on at

    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

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Pallavi Phade Profile Picture

Pallavi Phade 94

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 69 Super User 2025 Season 2

#3
TAHER Mehdi Profile Picture

TAHER Mehdi 58

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans