Blog

How to Manage HubSpot Duplicates with the Microsoft Dynamics 365 Integration

Written by Jonas | October 30, 2026

When marketing lives in HubSpot and sales lives in Microsoft Dynamics 365, duplicates stop being a HubSpot-only problem. One person can exist as a HubSpot contact, a Dynamics lead and a Dynamics contact at the same time. One company can exist as two HubSpot companies tied to two Dynamics accounts. Merge the wrong pair in HubSpot and you don't just lose a record: you break the link between the two systems, and the duplicate often comes straight back on the next sync.

This guide shows you how to clean up and prevent duplicates with the HubSpot–Dynamics 365 integration switched on, using the one thing both systems agree on: the Dynamics 365 GUID.

4 key concepts you need to know

1. Dynamics 365 is the source of truth for synced records
Treat Dynamics as the source of truth for accounts and for anyone your sales team already works. The integration syncs HubSpot companies with Dynamics accounts, and HubSpot contacts with both Dynamics contacts and Dynamics leads. Note that Dynamics leads land on HubSpot contacts, not on HubSpot's own Leads object. That last part matters. HubSpot treats every person as a contact with a lifecycle stage, while Dynamics splits people into leads and contacts. So the same person can legitimately carry a Lead GUID and a Contact GUID, for example after a lead is qualified. Decide which system owns each field before you merge anything, or you'll create conflict loops where both systems keep overwriting each other.

2. Every synced record has a GUID. Make it visible in HubSpot
Every Dynamics record has a 36-character globally unique identifier: accountid on accounts, contactid on contacts, leadid on leads. Unlike a name, email address or domain, the GUID never changes. Store it on the HubSpot record as a custom property, and store the HubSpot Record ID on the Dynamics record. You now have a cross-reference key that survives renames, new email addresses and domain changes. Custom field mappings need Data Hub Starter or higher.

➡️ Learn more about HubSpot deduplication

3. HubSpot's built-in deduplication won't catch this for you
HubSpot deduplicates contacts by email and companies by domain, but that only goes so far with an integration in the middle. The sync matches people on email address, so the same person with a work and a personal address becomes two contacts. Companies are trickier. Dynamics lets you use composite keys such as domain plus country, so acme.com can legitimately exist as Acme UK, Acme US and Acme DE. Records that arrive through integrations aren't held to HubSpot's import-style domain check, so all three can land in HubSpot as separate companies sharing one domain. If you're moving off Dynamics entirely, read how to avoid a duplicate disaster when migrating to HubSpot. Dynamics' own duplicate detection rules (up to five published per table) help users in Dynamics, but they don't clean up what's already in HubSpot.

4. Merge in Dynamics first, and don't switch the sync off
If two HubSpot records are linked to two different Dynamics records, the duplicate lives in both systems. Merge in Dynamics first, then let HubSpot follow. If you merge in HubSpot first, only the primary record keeps its Dynamics link. The other Dynamics record is left without a HubSpot partner and can be created again as a new HubSpot record on the next sync. You're back where you started. Turning the sync off to merge in HubSpot is worse: it breaks the record mapping you depend on.

➡️ Learn more about how to merge HubSpot contacts

 

Set up your Dynamics 365 GUID properties in HubSpot

Create these custom properties in HubSpot and map them in the Dynamics 365 integration settings. Use single-line text, and make sure only the sync writes to them: no imports, no workflows, no manual edits.

HubSpot property HubSpot object Dynamics 365 field
Dynamics 365 Account ID Company accountid (Account)
Dynamics 365 Contact ID Contact contactid (Contact)
Dynamics 365 Lead ID Contact leadid (Lead)
Dynamics 365 Status Company, Contact statecode (Active / Inactive)

Then add the reverse link: a custom field in Dynamics that holds the HubSpot Record ID. When someone asks "which HubSpot record is this?", the answer is one click away in either system.

 

Why you also need an "active" GUID

Here's where Dynamics differs from Salesforce. When you merge two records in Dynamics, the subordinate record isn't deleted. Dynamics deactivates it and points it at the master record. That means the leftover HubSpot record keeps its GUID, and a duplicate rule that compares GUIDs will keep holding the pair apart, even though Dynamics has already decided they're the same.

The fix is a second set of helper properties that only hold a GUID while the Dynamics record is active:

  • Dynamics 365 Active Account ID (companies)
  • Dynamics 365 Active Contact ID (contacts)
  • Dynamics 365 Active Lead ID (contacts)

Keep them up to date with one HubSpot workflow per object:

  1. Trigger: Dynamics 365 Status has changed, or any Dynamics 365 GUID property has changed.
  2. Branch on Dynamics 365 Status.
    • Active: copy each GUID into its "Active" property.
    • Inactive: clear the "Active" properties.

Your Koalify rules use the Active properties. The raw GUIDs stay untouched, so you always keep an audit trail back to Dynamics.

💡 Inactive doesn't only mean "merged". Disqualified leads and deactivated accounts are inactive too. In most portals that's what you want, because an inactive Dynamics record shouldn't block a merge into an active one. Check with your sales team before you switch the workflow on.

 

How to merge duplicate companies with Dynamics 365 connected

A. When both companies sync with different Dynamics accounts

First, check they really are duplicates. Dynamics portals often hold several accounts on one domain on purpose: regional entities, subsidiaries, separate billing entities. If sales reports on them separately, don't merge them. Associate them as parent and child companies instead.

If they are true duplicates, merge the accounts in Dynamics first. To stop Koalify suggesting these pairs before Dynamics has resolved them, add the Active Account ID as a filter in your duplicate rules:

  • Company Name & Domain Name & Dynamics 365 Active Account ID
    • Company Name matches property Company Name
    • Company Domain Name matches property Company Domain Name
    • Dynamics 365 Active Account ID matches property (or is unknown) Dynamics 365 Active Account ID

If you run regional entities on a shared domain, add Country matches property Country so Acme UK and Acme DE are never paired.

Once the accounts are merged in Dynamics, the subordinate account turns inactive, its Active Account ID is cleared, and Koalify flags the leftover HubSpot company for merging into the survivor.

B. When only one company syncs with Dynamics

If one duplicate has a Dynamics 365 Account ID and the other doesn't, the synced record must survive as primary. Set a primary rule like:

  • Dynamics 365 Active Account ID & Last Activity Date
    • Dynamics 365 Active Account ID is known
    • Has latest Last Activity Date

How to merge duplicate contacts with Dynamics 365 connected

Duplicate contacts are the most common pattern, especially when marketing runs forms, events and enrichment in HubSpot while sales creates leads by hand in Dynamics.

 

A. When both contacts sync with different Dynamics records

Step 1: Merge in Dynamics first.
Keep the Dynamics record that's linked to the HubSpot contact you want to keep as the master. To find it, open the HubSpot contact, view all properties, and copy the Dynamics 365 Contact ID or Dynamics 365 Lead ID. Search for that record in Dynamics and use it as the master in the merge.

Step 2: Let Dynamics deactivate the subordinate.
Dynamics sets the subordinate record to Inactive. The sync carries that status to the leftover HubSpot contact, and your workflow clears its Active Contact ID or Active Lead ID. Because nothing is deleted, the leftover's HubSpot-only history (email engagement, form submissions, page views and unmapped properties) is still there, waiting to be merged rather than lost.

Step 3: Let Koalify pick up the merge automatically.
With its active GUID gone, the leftover no longer conflicts with the synced record. Your duplicate rules flag the pair, and the Koalify workflow merges it into the survivor. Dynamics decides which records are the same person, and HubSpot follows.

💡 Check this in your own portal: create a contact view filtered on Dynamics 365 Status is Inactive, with columns for Dynamics 365 Contact ID, Dynamics 365 Active Contact ID and the last sync date. Open a record you recently merged in Dynamics. If the status hasn't changed, check your sync filters: some setups exclude inactive records, so the status change never reaches HubSpot.

 

B. When only one contact syncs with Dynamics

  • Merge directly in HubSpot.
  • Koalify can detect duplicates by matching property values, even when contacts have different email addresses.
  • Add the active GUIDs as extra filters so Koalify never pairs two records that Dynamics still treats as two people: Dynamics 365 Active Contact ID matches property (or is unknown) and Dynamics 365 Active Lead ID matches property (or is unknown).
    • When the GUIDs are the same, or empty on one or both records, the pair is flagged.
    • When both are filled in and different, the pair is not flagged until it's resolved in Dynamics.

Some example rules:

  • First Name, Last Name & Company Name Match
    • First Name matches property First Name
    • Last Name matches property Last Name
    • Company Name matches property Company Name
    • Dynamics 365 Active Contact ID matches property (or is unknown)
    • Dynamics 365 Active Lead ID matches property (or is unknown)
  • First Name, Last Name & Mobile Phone Match
    • First Name matches property First Name
    • Last Name matches property Last Name
    • Mobile Phone matches property Mobile Phone
    • Dynamics 365 Active Contact ID matches property (or is unknown)
    • Dynamics 365 Active Lead ID matches property (or is unknown)
  • First Name, Last Name & Phone Match
    • First Name matches property First Name
    • Last Name matches property Last Name
    • Phone matches property Phone
    • Dynamics 365 Active Contact ID matches property (or is unknown)
    • Dynamics 365 Active Lead ID matches property (or is unknown)

💡 Watch for the lead–contact pair. If one record has an active Lead GUID and the other an active Contact GUID, Dynamics usually holds an open lead for someone who's already a contact. Let Koalify flag the pair, but keep it out of your automated workflow. Qualify or close the lead in Dynamics first. Its Active Lead ID clears itself, and the pair merges on the next run.

💡 When you add a new rule, activate it so it only flags duplicates, and don't enrol it in your merge workflow yet. Review the matches, then add it. An email domain rule is generally safe to automate once you've excluded free email domains such as Gmail and Outlook.

 

Pick the right primary record

The contact linked to Dynamics should almost always survive the merge, so it stays connected and keeps syncing. Use Koalify's primary rules to set this automatically, preferring a Dynamics contact over a Dynamics lead:

  • Dynamics 365 Active Contact ID is known, Unsubscribed from all is not true
    • Dynamics 365 Active Contact ID is known
    • Unsubscribed from all email is none of True
  • Dynamics 365 Active Lead ID is known (fallback when neither record is a Dynamics contact)

Bulk merge duplicates with the Dynamics 365 integration enabled

With these GUID-aware duplicate and primary rules in place, you can clear the backlog in bulk and keep merging new duplicates as the sync creates them, using Koalify's workflow action. That includes the leftover records from merges in Dynamics.

Set the following enrolment criteria on a contact workflow:

  • Koalify Is Primary Duplicate is equal to False
  • Koalify Duplicate Rules is any of [your Dynamics-safe rules]
  • Dynamics 365 Active Contact ID is unknown
  • Dynamics 365 Active Lead ID is unknown

Then add the Koalify workflow action Merge Duplicate Contact. Build the same workflow for companies, filtering on Dynamics 365 Active Account ID is unknown.

Koalify merges around 1,000 records an hour, running in the background. For scale: Fathom AI resolved 13,000 duplicate companies in 3 hours. A backlog that would take you weeks of one-by-one merging clears in an afternoon, and new duplicates from the sync are merged as they appear. Before your first bulk run, back up your HubSpot data.

 

FAQ

Why does the HubSpot Dynamics 365 integration create duplicates?

The sync matches people on email address, so one person with two addresses becomes two contacts. Dynamics also splits people into leads and contacts, while HubSpot has only contacts. And Dynamics often allows several accounts on one domain, which arrive in HubSpot as separate companies.

Should I merge duplicates in Dynamics 365 or HubSpot first?

If both HubSpot records are linked to different Dynamics records, merge in Dynamics first and keep the record already linked to the HubSpot record you want to keep. If only one record, or neither, is linked to Dynamics, merge directly in HubSpot.

What happens to the HubSpot record after a merge in Dynamics 365?

Dynamics doesn't delete the subordinate record. It deactivates it. The leftover HubSpot record keeps its GUID but its status changes to Inactive. A workflow clears its active GUID, and Koalify then merges it into the surviving record.

Can I merge HubSpot companies when Dynamics 365 is connected?

Yes, as long as at most one company is linked to a Dynamics account, or both are linked to the same one. If they're linked to two different accounts, merge the accounts in Dynamics first, or the duplicate can be recreated on the next sync.

Should I turn off the sync to clean up duplicates?

No. Turning the sync off to merge in HubSpot breaks the record mapping between the two systems. Merge in Dynamics first, then let Koalify merge the leftovers in HubSpot while the sync keeps running.

If your Dynamics sync is creating duplicates faster than you can merge them by hand, install Koalify free and set up your GUID-aware rules. You'll see every flagged pair inside HubSpot before a single record is merged. Your data stays in London, with SOC 2 Type II and ISO 27001 certification, which matters if you're syncing customer data under GDPR.

See your Dynamics duplicates in HubSpot →