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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

List only the duplicate leads in a view

(0) ShareShare
ReportReport
Posted on by 1,085

Hello Community Experts,

Is there any way where i can list all the duplicate records of a lead in a separate view?

I found OOB it is not possible, is it possible via code?

Please advise

Best Regards,

Sumaira Noor

I have the same question (0)
  • meelamri Profile Picture
    13,216 User Group Leader on at

    Hi Sumarai please avoid to duplicate your threads.

  • Suggested answer
    sdfasdf Profile Picture
    842 on at

    Hi Sumaira,

    I'm afraid you won't be able to create a view to list the duplicate records, however you can review the duplicate records by running a Duplicate Detection Job -- https://docs.microsoft.com/en-us/power-platform/admin/run-bulk-system-jobs-detect-duplicate-records -- which will take into account the Duplicate Detection Rules you have in place.

    You can always use SDK to retrieve the duplicate records as well, but that would involve more development effort than just running the Duplicate Detection Job.

    I hope it helps.

    Thanks,

  • Verified answer
    meelamri Profile Picture
    13,216 User Group Leader on at

    Hi, 

    I replay your scenario using some unsupported code. 

    First, you need to add a subgrid to you form. I used Lead Entity as an example. I added the subgrid within a section wish is hidden by default. 

     duplicates.png

    Then you can add this JS function in onLoad event. This function inject dynamically a fetchXml to the subgrid. Basically, I retrieve leads with the same Topic, FirstName and LastName. 

    function getDuplicates(executionContext) {
    
        var formContext = executionContext.getFormContext();
        if (formContext.ui.getFormType() != 1) {
            var duplicatesGridControl = formContext.getControl("Duplicates");
    
            if (duplicatesGridControl == null) {
                setTimeout(getDuplicates, 2000);
            }
            else {
                var leadId = formContext.data.entity.getId().replace("{", "").replace("}", "");
                var firstName = formContext.getAttribute('firstname').getValue();
                var lastName = formContext.getAttribute('lastname').getValue();
                var topic = formContext.getAttribute('subject').getValue();
    
                var fetchData = {
                    subject: topic,
                    firstname: firstName,
                    lastname: lastName,
                    leadid: leadId
                };
                var fetchXml = [
                    "",
                    "  ",
                    "    ",
                    "      ",
                    "      ",
                    "      ",
                    "      ",
                    "    ",
                    "  ",
                    "",
                ].join("");
    
                
                duplicatesGridControl.setFilterXml(fetchXml);
                duplicatesGridControl.refresh();
                var summaryObj = formContext.ui.tabs.get("Summary");
                var duplicatesObj = summaryObj.sections.get("Summary_Duplicates");
                duplicatesObj.setVisible(true);
            }
        }
    
    
    }
    
    

    Hope this helps, good luck :) 

  • Sumaira Noor Profile Picture
    1,085 on at

    Thanks a lot for the response Nathan and Mehdi

    Thank you for taking time to help me Mehdi. I tried the code and it shows the duplicates under subgrid.

    Many thanks for it. I learned something new.

    I will suggest this solution to my client. Hope she agrees for this.

    Best Regards,

    Sumaira Noor

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

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
Tom_Gioielli Profile Picture

Tom_Gioielli 108 Super User 2025 Season 2

#2
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans