Edit

Share via


Agent for contact deduplication in Dynamics 365 Sales with Dynamics 365 Customer Insights, Power Apps component framework, and Copilot Studio

Applies to: Dynamics 365 Sales, Dynamics 365 Customer Insights - Data, Power Apps, Copilot Studio

This solution combines Dynamics 365 Customer Insights - Data, Power Apps component framework (PCF), and Copilot Studio to help sales teams find and fix duplicate Contacts easily in their usual workflow.

Introduction

You can create contacts from many touchpoints, like when a customer service representative adds one during a call or when someone fills out a form to register for an event.

This process can create duplicate records for the same person, with different levels of completeness and accuracy in the contact table. Duplicate records create noise, confusion, and poor data quality, which can undermine communication and relationships with the contact.

Dataverse offers native duplicate detection, but it's limited in what it can find. It also doesn't let you fix duplicate entries (that is, merge) at the right time, like when a seller is looking at a specific contact record.

Keeping your contact data clean is crucial, especially if you want to get the most from your marketing and sales efforts. Clean data helps you reach the right person with the right context.

With the profile unification engine in Dynamics 365 Customer Insights - Data, you can easily find duplicate contacts. A Power Apps component framework (PCF) control can show the duplicated contacts in Dynamics 365 Sales to help the seller act on it. With Copilot APIs in PCF controls, a custom topic in Copilot in Dynamics 365 Sales can suggest the best merge option for each field across the duplicates.

This approach can make it much easier to keep your contact table clean by making the deduplication process almost effortless for the seller.

The following short video shows what the experience looks like for a seller. In this example, a potential duplicate shows up in the seller's workflow when they view a contact form, and the agent helps them accept or change the suggested merge.

Architecture

This diagram shows the architecture for the solution.

Screenshot of the deduplication agent architecture diagram.

Dataflow

  1. Contacts from Dataverse (and optionally any other data source that can help identify them better) are ingested into Dynamics 365 Customer Insights - Data.

  2. Set up Profile Unification in Dynamics 365 Customer Insights - Data with deduplication and matching rules that fit your business context.

  3. The system automatically applies CustomerId backstamping, creating a relationship (lookup column) from contacts to their corresponding unified customer profile in Dynamics 365 Customer Insights - Data. Two contacts that are identified as duplicates share the same CustomerId, linking to the same unified customer profile.

  4. When a Dynamics 365 Sales user browses a specific contact's form, the system shows a custom Power Apps Component Framework (PCF) control that surfaces potential duplicates identified earlier.

  5. A custom topic in Copilot in Dynamics 365 Sales Agent compares the values of each field for the current and potential duplicate contact, and suggests the best value.

  6. Through the PCF control, the Dynamics 365 Sales user can make corrections if needed, or accept the suggestion and trigger the merge operation.

  7. The Dataverse merge API runs the merge operation using the provided values and deactivates the duplicate contact.

Components

The following components are used in the reference architecture.

  • Dynamics 365 Customer Insights - Data offers a powerful profile unification engine that helps identify duplicate contacts using deduplication rules or matching rules with external data sources. This approach offers advanced capabilities, such as:

    • Multi-condition rules and multiple rules
    • Standard normalization, like Street, St, St. or st in an address
    • Custom normalization, like alias mapping. For example, the name Joe can be set to equal Joseph.
    • Fuzzy matching to account for typos, like bob@contoso.com instead of bob@contoso.cm.

    Duplicate contacts identified this way are unified into the same Customer Insights customer profile and automatically backstamped with the same CustomerProfileId in the corresponding Dataverse table.

  • Dynamics 365 Sales is the seller's app where the seller accesses contact details through dedicated model-driven app (MDA) forms and acts on them. Here, it's helpful to show potential duplicates and prompt the seller to address them with minimal effort.

  • The Power Apps Component Framework (PCF) lets you create a custom control that you embed in the contact form. The custom PCF control checks for identified potential duplicates (based on shared CustomerProfileId) and, if found, shows a side-by-side comparison of important field values for the current contact and its duplicate. When the user acts, the control triggers the merge operation for the two contacts using the unbound action API.

    Using the Copilot APIs, the custom PCF control executes an event to call a custom Copilot topic, passing parameters and showing the result.

  • In Microsoft Copilot Studio, the Copilot in Dynamics 365 Sales agent is extended with a custom topic that receives the current contact and duplicate contact as parameters, and then uses a prompt node to compare them, identify the best values for each field, and return a predictable structured .json, as instructed in the prompt, which is shown as the default choice for merging in the custom PCF control.

Scenario details

When duplicate contacts exist, they might not be easy to spot if they aren't obvious duplicates. Even if someone identifies them, merging duplicates can seem like an administrative task with no clear owner.

Having duplicate contacts leads to a fragmented and inaccurate view of the customer. This results in inefficient engagement, whether directly or through personalized marketing, and creates a poor customer experience.

Making it easy to surface duplicates to the right person at the right time—like the seller who owns the contact during their daily work—and letting them address it with the Copilot Agent makes keeping data clean effortless.

Considerations

These considerations help implement a solution that includes Dynamics 365. Learn more at Dynamics 365 guidance documentation.

Cost optimization

Cost optimization means finding ways to reduce unnecessary expenses and improve operational efficiency. Learn more at Overview of the cost optimization pillar.

In this reference architecture, app components like Dynamics 365 Customer Insights - Data and Dynamics 365 Sales are online business applications with their own licensing model, so using this pattern doesn't affect costs.

However, Microsoft Copilot Studio consumes credits when used, either through packs or pay-as-you-go. For example, you can check if a potential duplicate exists for the current contact with a low-code approach in the custom Copilot topic. In many cases, it's better to use a pro-code approach in the PCF control, so it only calls the custom Copilot topic when there's an existing duplicate. This approach reduces the number of messages and credits used.

Review these related architecture guides, solutions, and other guidance content:

Contributors

This article is maintained by Microsoft. It was originally written by the following contributors.

Principal author: