Deduplicate HubSpot and Salesforce While Keeping the Sync Active

deduplicate salesforce and hubspot

How to Merge Duplicates across HubSpot and Salesforce While the Sync Is Active

Your sales team is using both HubSpot and Salesforce and is running into duplicate records in one CRM or the other, and sometimes in both. 

You have a data sync set up between the two systems, but don't know how to deduplicate effectively to ensure a consistent cleanup effort across CRMs. Also, merging records in one CRM can affect linked records in the other, and merging into different master records in each CRM breaks the sync.

With Insycle's Merge Duplicates module, you can bulk merge duplicate people and companies automatically, including through HubSpot Workflows and Salesforce Flows, while the HubSpot-Salesforce sync is active. You can also manage the merge process by setting rules to select the master record and determine which values to keep. For instance, you might choose to retain the owner from the first contact created.

Before You Start: Two Setup Steps That Keep Both CRMs in Sync

Because HubSpot and Salesforce are connected, a merge in one platform can affect records in the other. Before running any merge operations, you need two things in place: one deletion behavior setting in HubSpot and one custom field in both CRMs. Together, they ensure that both platforms merge into the same master record and that no records are unintentionally removed during the process.

  • Set HubSpot's deletion behavior to "Do nothing" — This ensures that when a Salesforce record is merged away, the corresponding HubSpot record is not automatically deleted. It will remain in HubSpot as an unlinked record and will need to be cleaned up separately after the merge. This is covered in #1.
  • Create the Deduplication Master Record field in both CRMs — Because Salesforce lacks a native field indicating which record is actively synchronizing with HubSpot, this custom field provides that visibility. Insycle stamps it on the master record after the Salesforce merge and uses it to align master selection during the HubSpot merge. This is covered in #2.

An alternative to the custom field approach is also available and documented at the end of this article. See Alternative: Create a HubSpot ID Field in Salesforce.

Process Summary

  1. Set HubSpot's deletion behavior to "Do nothing" before any merge operations.
  2. Create the Deduplication Master Record field in both CRMs and configure the property mapping.
  3. Merge duplicates first in Salesforce using Insycle, which automatically stamps the master record.
  4. Before running the HubSpot merge, run an incremental Insycle sync on the HubSpot database to ensure the Deduplication Master Record value has propagated.
  5. Merge duplicates in HubSpot using the Deduplication Master Record field to select the master.

Step-by-Step Instructions

1. Required HubSpot-Salesforce Sync Setting

Before merging any duplicate records in Salesforce, you must verify one critical setting in HubSpot. If this setting isn't configured correctly, merging records in Salesforce will send the corresponding HubSpot records to the recycle bin, which can be difficult to fully restore.

In HubSpot, the deletion behavior setting controls what happens to a HubSpot record when its linked Salesforce record is deleted or merged. When you merge duplicate records in Salesforce, the records being merged into the master are deleted. If HubSpot is set to mirror that deletion, those HubSpot records will be moved to the recycle bin automatically — even though you intentionally merged them, not deleted them.

To prevent this, the HubSpot deletion behavior for each synced object type you plan to deduplicate must be set to "Do nothing" before you begin.

  1. In HubSpot, navigate to Settings > Integrations > Connected Apps.

  2. Click Salesforce in the My Apps list.

  3. On the app settings page, click the Data sync tab.

  4. In the left sidebar menu, click the object you plan to deduplicate (for example, Contacts or Companies), then click Sync rules.

  5. To ensure that HubSpot duplicates are not automatically deleted when you merge in Salesforce, under Deleting [Objects] (for example, Deleting Companies), verify that the following settings are in place for each synced object type you plan to deduplicate:

    • When a Salesforce contact is deleted → Do nothing in HubSpot.
    • When a Salesforce lead is deleted → Do nothing in HubSpot.
    • When a Salesforce account is deleted → Do nothing in HubSpot.
When a Salesforce object is deleted settings

The image above shows the Deleting Contacts section of the Contact Sync Rules page on the Data sync tab of the Salesforce integration in HubSpot. When a contact or a lead is deleted in Salesforce, the HubSpot dropdown is set to Do nothing. When a contact is deleted in HubSpot, Salesforce is set to Do nothing, shown in a gray field without a dropdown arrow.

Important: Do not proceed with merging any Salesforce records while the HubSpot sync is active until you have confirmed these settings. This applies whether you are running a manual or automated merge.

Note: After completing the Salesforce merge, any HubSpot records whose Salesforce counterparts were merged away will remain in HubSpot as unlinked records — they will not be automatically removed. You will need to clean these up separately. This is expected behavior when the deletion setting is "Do nothing," and it is preferable to records being sent to the recycle bin unintentionally.

2. Create Custom Fields in Your CRMs to Tag the Master Record

To label records as the master for each set of duplicates, you'll need to create a custom field in both platforms. In each CRM, HubSpot and Salesforce, add a custom field named “Deduplication Master Record.” Add this to any synced object type you plan to deduplicate.

Insycle will automatically populate this field with the correct value. To prevent users from accidentally changing its value, you may want to hide this field from the default layout or make it non-editable.

Add the Custom Field in Salesforce for Each Object Type

  1. In Salesforce, navigate to Setup > Objects and Fields > Object Manager. 

  2. Select the object type, click Fields & Relationships, then click the New button.

  3. Enter the following properties:

    • Data type: Checkbox

    • Field Label: Deduplication Master Record

    • Default Value: Unchecked

Repeat these steps to add the Deduplication Master Record field to each object type synced with HubSpot that you'll need to deduplicate.

Salesforce Object Manager

The image above shows the Account Custom Field detail page for the Deduplication Master Record field in Salesforce Setup, under Object Manager with Fields & Relationships selected in the left menu. The Custom Field Definition Detail section lists the Field Label as Deduplication Master Record, the Field Name as Deduplication_Master_Record, the API Name as Deduplication_Master_Record__c, the Object Name as Account, and the Data Type as Checkbox.

Add the Custom Field in HubSpot for Each Object Type

  1. In HubSpot, navigate to Settings > Objects > Select an object

  2. Click Manage [object] properties, and click the Create property button. 

  3. Enter the following properties:

    • Label: Deduplication Master Record
    • Field type: Single checkbox
  4. Click Create property.

Repeat these steps to add the Deduplication Master Record field to each object type synced with Salesforce that you'll need to deduplicate.

hubspot-settings-contacts-create-property-deduplication-master-646w.png

The image above shows the Create new property panel in HubSpot settings, with the Create manually tab selected. The Property label field contains Deduplication Master Record, and the Field type dropdown is set to Single checkbox. Both fields are marked as required with an asterisk.

Set Property Mapping for Deduplication Master Record Field

Next, set the object settings to copy the custom field value from Salesforce into HubSpot (one-way).

  1. In HubSpot, navigate to Settings > Integrations > Connected Apps > Salesforce.

  2. On the app settings page, click the Data sync tab.

  3. Select the object type from the menu on the left, then select Property mappings.

  4. Click the Add new field mapping button and use the dropdown menus to select the "Deduplication Master Record" HubSpot property and Salesforce fields. hubspot-settings-create-new-mapping-deduplication-master-record-646w.png
    The image above shows the Create new field mapping dialog in HubSpot's Salesforce integration settings' Create New Mapping step. Under Map HubSpot property to Salesforce field, the HubSpot property dropdown and the Salesforce field dropdown are both set to Deduplication Master Record, linked by a dashed line to show the mapping between them.

  5. For the Sync Rule, select Always use Salesforce.

  6. Click Save.

Follow the same process for each synced object type.

3. Deduplicate Salesforce Records in Insycle

To deduplicate Salesforce records in Insycle, navigate to Merge Duplicates and configure your matching and master selection rules as follows.

  1. Navigate to Data Management > Merge Duplicates, select the Salesforce database and object type.
  2. In Step 1. Find Duplicates, choose Salesforce fields, and set the criteria values must meet to be considered a duplicate. In the example below, we are looking for Salesforce contacts with the exact same First Name and Last Name and Email Domain.merge-duplicates-salesforce-contacts-step-1-simple-tab-first-last-domain-exact-646w.png
    The image above shows the 1. Find Duplicates step in the Merge Duplicates module with the Simple tab selected. Three rules match on First Name, Last Name, and Email Domain, each using Exact Match and Entire Value; First Name and Last Name ignore Symbols, and Email Domain ignores a Top-Level Domain option. The Include Leads checkbox is unchecked, and the Filter button shows a badge with 1.
  3. Under Step 3. Merge Logic on the Master tab, configure the rules that specify which record from each set of duplicates becomes the master—the record that remains after the merge and that all other duplicate records merge into.merge-duplicates-salesforce-contacts-step-3-master-tab-not-bounced-email-owner-modified-created-646w.png
    The image above shows the 3. Merge Logic step in the Merge Duplicates module in Bulk mode with the Master tab selected. Five master rules are listed in order: Is Email Bounced is False, Email is not role-based (info@, etc.), Contact Owner exists, Last Modified Date is latest, and Created Date is earliest. Processing is set to By Priority, and Exclusions skips duplicate groups with more than 5 records per group.

  4. After Insycle identifies the master record, it uses the selection rules on the Fields tab to automatically select which values from a duplicate group to use in the master record.
    For each field you want to control data retention for, you need to tell Insycle where to source the field's data. This is merged into the master. For example, you could retain the record owner based on the earliest created record. Any data not in the master, or not copied to it, will be lost when the records are merged.merge-duplicates-salesforce-contacts-step-3-fields-tab-owner-email-ID-language-merged-646w.png
    The image above shows the 3. Merge Logic step in the Merge Duplicates module in Bulk mode with the Fields tab selected. There are 6 rules set: Contact Owner from the record with the earliest Created Date, Email from a record where the value is not role-based, and Account ID from the master record. Languages combines and appends values, Merged Contact Owner collects Contact Owner values, and Merged Contact IDs collects non-master Contact ID values.

As part of the merge process, Insycle will automatically populate the Deduplication Master Record field with the value “True” for the record that is chosen as the master.

For further instructions on configuring your Salesforce deduplication, see the Salesforce Merge Duplicates Overview article.

To finish deduplicating your Salesforce records, continue with #6. Preview Deduplication Changes, then Apply Merge to CRMs below.

4. Run an Incremental Insycle Sync Before the HubSpot Merge

Before running the HubSpot merge, you need to run an incremental sync in Insycle to pull the latest HubSpot data — including the Deduplication Master Record value that was written during the Salesforce merge. Without this step, Insycle may not yet reflect the updated field value, and the HubSpot merge will not correctly identify the master record.

This step is necessary because of a timing dependency: when Insycle ran the Salesforce merge in #3, it stamped the Deduplication Master Record field on the master record in Salesforce. That value then propagated to HubSpot via the database synchronization between the two platforms. However, Insycle's own copy of the HubSpot data may not yet reflect that updated value. Running the incremental sync here ensures Insycle reads the current state of HubSpot before determining which record to select as master in #5.

  1. Navigate to Settings > Sync Status, and next to the account name, click the Sync changes from last day button (lightning bolt icon)settings-sync-status-sync-changes-from-last-day-w-arrow-hubspot-700w.png
    The image above shows the Settings > Sync Status page, listing a HubSpot account on the Professional plan and a Salesforce account on the Business plan, both named Building Robotics. An arrow points to the lightning bolt icon in the HubSpot row’s Actions column, which also contains a life ring and a trash can icon. A tooltip reads “Sync changes from last day.” The Salesforce row shows a plug icon alongside the same three icons.

  2. You'll see a confirmation that Insycle has kicked off an incremental sync for the changes made in the last day.incremental sync
    The image above shows the Incremental Sync confirmation dialog that appears on the Settings > Sync Status page after clicking the Sync changes from last day button (lightning bolt icon). The message reads "Triggered sync of changes from the last day."

Note: Manual syncing covers records modified in the past 24 hours, so this should reflect the Deduplication Master Record value written from Salesforce to HubSpot during the Salesforce merge.

Once the incremental sync is complete, proceed to #5 to run the HubSpot merge.

5. Deduplicate HubSpot Records in Insycle

After the Salesforce merge, the Deduplication Master Record values will automatically sync from Salesforce to HubSpot. You can then use this field to identify the same record as the master in HubSpot.

  1. Under Step 1. Find Duplicates, use the same criteria as for Salesforce deduplication to determine which HubSpot records should be considered duplicates.merge-duplicates-hubspot-contacts-step-1-first-last-email-domain-exact-646w.png
    The image above shows match rules configured in the Simple tab of 1. Find Duplicates of the Merge Duplicates module, matching on First Name and Last Name using Exact Match with Symbols ignored and First 5 Characters compared, and on Email Domain using Exact Match with the Top-Level Domain ignored and the Entire Value compared. The "1" badge on the Filter button indicates one filter is applied.

  2. Under Step 3. Merge Logic on the Master tab, configure one rule: select records with a Deduplication Master Record value of "Yes" as the master.merge-duplicates-hubspot-contacts-step-3-master-tab-deduplication-master-record-646.png
    The image above shows the 3. Merge Logic step in the Merge Duplicates module in Bulk mode with the Master tab selected. A single master rule is configured: Deduplication Master Record is Yes. Processing is set to By Priority, and Exclusions skips duplicate groups with more than 5 records per group.

Because the incremental Insycle sync ran in #4, the Deduplication Master Record value stamped during the Salesforce merge is now available in HubSpot and ready for master selection.

Note: When the HubSpot-Salesforce sync is enabled, HubSpot companies default to Synthetic merge. Native merge for these companies is available to beta users; contact Insycle Support to request access. HubSpot contacts can only use Native merge. See Native vs. Synthetic Merge for details.

For further instructions on configuring your HubSpot deduplication, see the HubSpot Merge Duplicates Module Overview article.

6. Preview Deduplication Changes, then Apply Merge to CRMs

Preview each merge before you apply it. Run the Salesforce merge in Preview mode and review the CSV report, then apply it in Update mode. After you complete #4 and #5, repeat the same Preview and Update process for the HubSpot merge.

The first time you apply each merge in Update mode, consider merging a small batch first to check how associations are reassigned in your CRM. Once both merges run as expected, you can save your configurations as templates and automate them so Salesforce and HubSpot stay deduplicated while the sync is active.

For the full walkthrough, including how to read the CSV Status column, choose which duplicate groups to include, and schedule your merge, see Running Your Merge.

merge-duplicates-hubspot-contacts-first-last-name-email-csv.png

The image above shows a Merge Duplicates CSV report for HubSpot contacts with columns for Result, Message, Duplicate Group ID, Status, First Name, Last Name, Email, and Record ID. Three duplicate groups are listed, each with a Duplicate row, a Master row, and a Master (After) row showing the final values. Every row shows Merged in the Result column and Succeeded in the Message column.

 

How the Deduplication Master Record Field Works

The Deduplication Master Record field is a custom field created in both Salesforce and HubSpot that lets Insycle identify and use the same master record across both CRMs during deduplication, even while database synchronization between the two platforms remains active.

When you merge duplicates, the records are combined into a single master record. If you merge records in two platforms, you must ensure all duplicates in both platforms merge into the same master record synced between HubSpot and Salesforce. When the master record differs, the sync between the two platforms breaks. 

By creating a custom field synchronized across both CRMs, you give Insycle a reliable indicator of which record is designated as master. When Insycle reads this field during the HubSpot merge, it selects the same record that was designated as the master in Salesforce — ensuring both platforms converge on the same record and that database synchronization between them remains intact.

Because the Salesforce merge runs first, you set up complete master selection rules for Salesforce in Step 3. Merge Logic of Insycle’s Merge Duplicates module. When you run the Salesforce merge, Insycle sets the “Deduplication Master Record” field to “True” for the record identified as the master. That value then reaches HubSpot, where it appears as “Yes.”

When you set up the HubSpot merge, you only need to specify how to select the same master record, based on the “Deduplication Master Record” value being “Yes.”

merge-duplicates-hubspot-contacts-step-3-master-tab-deduplication-master-record-646.png

The image above shows the 3. Merge Logic step in the Merge Duplicates module in Bulk mode with the Master tab selected. A single master rule is configured: Deduplication Master Record is Yes. Processing is set to By Priority, and Exclusions skips duplicate groups with more than 5 records per group.

Alternative: Create a HubSpot ID Field in Salesforce

The Deduplication Master Record field approach described in this article is the recommended method for most teams. However, if you prefer not to use it, an alternative achieves the same goal—identifying which Salesforce record is actively synchronizing with HubSpot so it can be selected as master.

Because Salesforce lacks a native field indicating which of its records are linked to HubSpot, you can create one. In Salesforce, create a custom number field (18 digits) on each object type you plan to deduplicate. Then, in HubSpot's Salesforce integration property mappings, map the HubSpot record ID to that custom Salesforce field and set the sync rule to Two-way. Because the HubSpot record ID is system-generated and not editable, Salesforce cannot overwrite it, so the sync effectively works in one direction, from HubSpot to Salesforce. After the sync runs, any Salesforce record with a linked HubSpot counterpart will have this field populated; records without one will have it empty. You can then use this field in Insycle's Master Selection rules to select master records that have the field populated.

Note that regardless of which approach you use, setting HubSpot's deletion behavior to "Do nothing" (#1. Required HubSpot-Salesforce Sync Setting) is still required.

Frequently Asked Questions

Can I merge HubSpot companies and Salesforce accounts without breaking the sync?

You can merge Salesforce accounts and HubSpot companies without breaking the database synchronization between the two platforms by using Insycle's Merge Duplicates module. To learn more, see the article Deduplicate HubSpot Companies and Salesforce Accounts.

Does it matter which platform I run the original deduplication process in?

The order in which you run the original deduplication process matters: running the Salesforce merge first is strongly recommended when deduplicating across Salesforce and HubSpot. The order matters because of how Salesforce-HubSpot database synchronization handles merged records, and merging in HubSpot first can automatically re-create duplicate records.

When a record is merged in Salesforce, HubSpot automatically sets a hidden property called Salesforce Deleted to “True” on the corresponding HubSpot record. This property exists on all synced object types — contacts, leads, and companies. Once set to “True,” HubSpot stops synchronizing that record and will not re-create it in Salesforce, even if the record is updated or meets your Salesforce inclusion criteria. This prevents the merge from triggering an unintended loop in which the next sync re-creates a merged record.

If you merge in HubSpot first instead, the duplicate HubSpot company record is removed — but its corresponding Salesforce account still exists and remains active. The next time that Salesforce account is updated, the database synchronization between the two platforms may re-create the HubSpot record, effectively undoing the merge.

Merging in Salesforce first ensures the Salesforce Deleted flag is set on the correct HubSpot records before the HubSpot merge runs, so no merged records are re-created by the synchronization.

How can I tell which Salesforce record is actively syncing with HubSpot?

Salesforce has no native field indicating whether a record is actively synchronizing with HubSpot — that information lives on the HubSpot side, via the Salesforce object ID property. Without visibility into this from Salesforce, you cannot reliably use Insycle's Master Selection rules to guarantee the syncing record becomes the master.

There are two ways to create that visibility:

  • Use the Deduplication Master Record field approach — This is the method described in this article. A custom checkbox field is created in both CRMs and synchronized one-way from Salesforce to HubSpot. After Insycle runs the Salesforce merge and stamps the master, that value propagates to HubSpot and is used to align master selection in the HubSpot merge. This is the recommended approach for most teams.
  • Create a custom Salesforce field that HubSpot writes its record ID into — In Salesforce, create a custom number field (18 digits) on each object type you plan to deduplicate. Then, in HubSpot's Salesforce integration property mappings, map the HubSpot record ID to that custom Salesforce field with the sync rule set to Two-way. Because the HubSpot record ID is system-generated and not editable, Salesforce cannot overwrite it — so two-way sync behaves safely here. After the sync runs, that Salesforce field will be populated on any record with a linked HubSpot counterpart and left empty on records without one. You can then use that field in Insycle's Master Selection rules — records where this field is populated should be preferred as master.

In both cases, you still need to set HubSpot's deletion behavior to "Do nothing" first as a safety net, regardless of which approach you use.

hubspot-settings-connected-apps-contacts-deleting-rules-646w.png

The image above shows the Deleting Contacts section of the Salesforce app integration's Object Data Sync settings in HubSpot. This section controls what happens in one system when a contact is deleted in the other. The settings are configured directionally: when a Salesforce contact or lead is deleted, HubSpot is set to Do nothing. When a contact is deleted in HubSpot, Salesforce is set to Do nothing, shown in a gray field without a dropdown arrow (this cannot be edited from HubSpot).

Refer to #1. Required HubSpot-Salesforce Sync Setting above for detailed configuration instructions.

Do I have to create the Deduplication Master Record field for this to work?

Creating the Deduplication Master Record field in both Salesforce and HubSpot is required for the approach described in this article. Without it, Insycle has no reliable way to identify which record was selected as master in Salesforce and carry that selection over to HubSpot, which means both merges may not converge on the same master record, breaking the database synchronization between the two platforms.

If you prefer not to use the Deduplication Master Record field, an alternative is to create a custom Salesforce field that HubSpot writes its record ID into via the sync property mappings. This gives you a Salesforce-side indicator of which records are actively synchronizing with HubSpot, which you can then use in Insycle's Master Selection rules. See the FAQ: How can I tell which Salesforce record is actively syncing with HubSpot? for details on both approaches.

After merging in both Salesforce and HubSpot, why isn’t the "Deduplication Master Record" option Yes/True in either CRM?

When you’ve merged duplicate records in Salesforce or HubSpot (whichever you’ve done first), the “Deduplication Master Record” value should be set to "True" in Salesforce and "Yes" in HubSpot in both CRMs by the sync. However, it may happen that synchronization of this data to Insycle is delayed. In this case, when you perform the merge operation on the second platform, it does not know that the “Deduplication Master Record” value is now “yes/true,” so it sets the value to "no/false" in the CRM, which is then synced to the other CRM.

To resolve this, after running the operation in the first CRM, perform an incremental sync in Insycle on the second CRM before running that merge operation.

Navigate to Settings > Sync Status, and next to the account name, click the Sync changes from last day button (lightning bolt icon). You should now be able to proceed with the second merge.

settings-sync-status-sync-changes-from-last-day-w-arrow-hubspot-700w.png
The image above shows the Settings > Sync Status page, listing a HubSpot account on the Professional plan and a Salesforce account on the Business plan, both named Building Robotics. An arrow points to the lightning bolt icon in the HubSpot row’s Actions column, which also contains a life ring and a trash can icon. A tooltip reads “Sync changes from last day.” The Salesforce row shows a plug icon alongside the same three icons.

Alternatively, you can run your merge in Salesforce first, then use a HubSpot Workflow to trigger the corresponding merge. Set up the trigger “Deduplication Master Record is known.” This will push the latest values for any enrolled records to Insycle in real time.

hubspot-workflow-merge-companies-after-salesforce-merge.png

The image above shows a HubSpot Workflow configured to trigger on 'Deduplication Master Record is known,' which pushes the latest field values to Insycle in real time.

For answers to other deduplication questions, see the Merging Duplicates FAQs.

Additional Resources

Related Help Articles

Related Blog Posts