Deduplicate HubSpot Companies and Salesforce Accounts

How to Merge Duplicate Salesforce Accounts and the Corresponding HubSpot Companies

If you have your HubSpot and Salesforce CRMs set up to sync, this can make cleaning up duplicates tricky. You need to determine the appropriate “master record” to use across both CRMs and, you have to consider the merging process. Often, your settings in each platform impact how the merge takes place.

When you deduplicate accounts in Salesforce, the master is kept in sync with the original HubSpot record, indicated by a Salesforce Account ID value. But the deduplication only takes place on the Salesforce side—leaving duplicate companies in HubSpot. Since HubSpot doesn't allow you to deduplicate companies while the sync is active from within the HubSpot app, you need another option.

Insycle allows you to merge duplicate HubSpot companies and Salesforce accounts while keeping things simple and your sync intact.

Process Summary

  1. Merge duplicate Salesforce accounts.
  2. Set up HubSpot merge rules to select the HubSpot record that has a Salesforce Account ID as the master record.
  3. Merge duplicate HubSpot companies.  


Step-by-Step Instructions

1. Deduplicate Salesforce Accounts in Insycle

Navigate to Data Management > Merge Duplicates, and select the Salesforce database and Accounts record type from the top menu. Then explore the templates for an existing solution that may be close to what you need.

Each row in Step 1 is for a field you want to look at for duplicates, along with some parameters on what to look for. For example, you may look for account records that have the exact same Website AND similar Account Names.


Under Step 4 on the Record tab, configure the rules that specify which record all the other duplicate records will merge into. This will be your master record. Select the field that gives the most likely indication that a record might be the master record, and what condition this field must meet.

For each duplicate group, Insycle will look at each Record rule to see which of the records in the group meet the criteria. Rules are read in order, from top to bottom. The first record that is the only one that matches a rule will be selected as the master record, and further rules will be ignored.

Master selection rules for Salesforce accounts

After Insycle has identified the master record, it will use the selection rules from the Field tab to automatically pick which values from a duplicate group will be used in the master record.

For each field you want to control the data retention for, you need to tell Insycle where the data for the field should be taken from. This is merged into the master. Any data that is not in the master or not copied to the master will not be included in the master once merged.


To finish deduplicating your Salesforce records, continue with the 3. Preview Deduplication Changes then Apply Merge to CRMs step below.

For further instructions on configuring your deduplication, see the Bulk Merge Duplicate People, Companies article.

2. Deduplicate HubSpot Companies in Insycle

When duplicate companies are created in HubSpot, the duplicates won't automatically sync with Salesforce, so the Salesforce Account ID field will be blank.

Since only the company that is synchronizing with Salesforce will have the Salesforce Account ID, the presence of this value can be used to identify the correct HubSpot record to choose as the master.

Under Step 1, use the same criteria as for Salesforce deduplication to determine which HubSpot records should be considered duplicates.


Under Step 4, select Priority Match in the header.

On the Record tab for the very first rule, select the Salesforce Account ID field with the Condition, "exists." Since these rules execute in order, if the Salesforce Account ID is found in one of the duplicate records, it will be chosen as the master and the rest of the rules in the list are ignored.


After Insycle has identified the master record, it will use the selection rules from the Field tab to automatically pick which values from a duplicate group will be used in the master record.


If you do not specify what to keep for a field—when a field value is empty in the master record, Insycle picks a non-empty value from the most recently updated duplicate automatically.

Once you think you have all your Record and Field rules set, run a preview to see how it goes.

3. Preview Deduplication Changes, then Apply Merge to CRMs

Preview Merges in CSV Report

After you have the deduplication rules set up for each CRM, you should preview the changes you are making to your data. That way, you can check to ensure your merge configuration is working as expected before those changes are pushed to your live database. 

Under Step 5, click the Review button and select Preview mode.


Click the Next button to go to the Notify screen, where you can select recipients for the email report. You can also add additional context to the message.

On the When tab, click the Run Now tab, and select which records to apply the change to (in most cases this will be All), then click the Run Now button.


Insycle will generate a preview CSV and send it to your email. Open the CSV file from your email in a spreadsheet application.


The Status column indicates:

  • Duplicate – The record is part of a duplicate group.
  • Master The master record chosen for the duplicate group based on default behavior and your Record rules. Review the selections in this row to determine whether the appropriate records are being chosen.
  • Master (After) – This appears only if at least one or more fields have been specified in Step 4 on the Fields tab. For each duplicate group, the Master (After) row shows the values the final record will contain based on your Field rules and the default behavior. 
  • Error – If Insycle is not able to determine which record would be the master, an error message will appear here. See the Troubleshooting section below for more details.

If everything looks good, return to Insycle and move forward with applying the changes.

Apply Changes to Your CRM Records

When you're satisfied with the results in your preview, you can merge the records in your CRM.

Under Step 5, click the Review button, and this time select Update mode.

On the When tab, you should use Run Now the first time you apply these changes to the CRM.

Update CRM records now

Save Templates and Setup Automation to Maintain Formatting

After you've seen the results in the CRM and you are satisfied with how the operation runs, you can set up ongoing automated deduplication for HubSpot and Salesforce records with Insycle templates, or integrate with Workflows on the HubSpot side.

With automation, you'll save time and ensure that HubSpot and Salesforce are consistently deduplicated while keeping the sync active.

Automate template

Advanced How-Tos

Step 1: Setting Up the Fields to Find Duplicates

Each row in your matching fields setup is cumulative, so records must meet all of the criteria. For example, looking for records that have the same First Name and Last Name and Phone Number returns only results where all three values are the same.

  The minimum required length for the matching values is four characters or more. Values such as "Joe" or "Ace" will be disregarded.

Field Name Comparison Rule Ignored Match Parts

Pick a field that you think has some duplicate values.

Running a very simple match operation like just First and Last Name is okay for giving you an idea of what you have, but it is too broad to use for reliable analysis and deduplication. There may be legitimate duplicate names–different people with the same first and last name. You need additional, unique criteria to narrow it down.

Choosing Unique Identifiers

Matching duplicates requires unique identifiers—data that is unlikely to be shared by any other record unless it is a duplicate. If you don't use unique identifiers, you are likely to identify unrelated records as duplicates and may accidentally merge them.

Many CRMs match first names, last names, and email addresses. If all of those match, or are similar, you can confidently determine that the record is a duplicate.

Other unique identifying fields that are commonly used in deduplication include:

    • Phone number
    • Domain name
    • Mailing address
    • ID number
Step 1: Matching Using Two Different Fields

Sometimes, you might want to match duplicates using data in two separate fields. For example, you might want to compare your Phone Number field to a Mobile Phone Number field to identify duplicates.

Using the Related Fields feature, you can use two different fields (that contain similar data) as matching fields to catch more duplicates.

You can set up Related Fields in the Advanced tab.


Common Examples of Related Field Matching

Matching Field Related Fields
Phone Number Mobile Phone Number, Company Phone
Email Domain Website, Company Domain
Email Additional Email Addresses
Address Company Address
Step 1: Allowing Empty Values When Matching

When using two or more fields to identify duplicates, records can still be considered matches even if one of the field values is blank. You just need to specify which field(s) allow a blank value.

Under Step 1, configure your matching rules in the Simple tab, then click the Conditions tab.


All the matching fields you included will automatically appear with the Value Required in All Records condition selected. Change the condition to Empty Allowed in Any Record to allow empty values for certain fields. You can also use the At Least One Record with Non-Empty condition to help you determine which is the master record. Make sure at least one field remains required and is a reliable unique identifier to ensure the records are really duplicates.


For example, on the Simple tab, you may have the matching fields: First Name, Last Name, and Phone Number. But on some of your records, the Phone Number field may be empty. Using the conditions "Empty Allowed in Any Record," or "At Least One Record with Non-Empty," all records with the same name, same phone number, and no phone number will be considered duplicates.


Step 1: Find Duplicates Created within X Minutes of Each Other

When customers encounter an issue when trying to make a transaction, they often seek help from one of your support channels. However, whenever a contact is created from a chat, like Facebook Messenger, Hubspot Chat, and others, very little information is provided—usually just a name and timestamp. This makes finding other instances of the same contact, such as their customer record, difficult.

With the Merge Duplicates module, under Step 1, you can use the Conditions tab to match contacts with the same name that were created or modified within the same period of time.

First, select the fields in the Simple tab. Then, on the Conditions tab, select the Within Timeframe condition and set the Minutes, Hours, or Days criteria. 


Step 4: Priority Match vs. Absolute Match

Priority Match and Absolute Match options

For each duplicate group, Insycle will look at each master selection rule to see which of the records in the group meet the criteria. At the right end of the Step 4 header, there are two different master selection options:

Priority Match: Looks through the master selection rules in order, one by one. As soon as a record meets one of the criteria, Insycle makes the master selection and skips the rest of the rules on the list. The vast majority of duplicate templates should use Priority Match.

Absolute Match: The master record must meet all of the listed rules in the Record tab in Step 4. If a record does not match every rule listed, no master record will be identified. Absolute Match is appropriate for less flexible master selection.

For example, if a company wants to ensure the chosen master record is in their sales pipeline and already has a sales rep working the record, they can choose Absolute Match and set the Record rules:

  • Customer Priority is "High"
  • Account Owner exists

Choosing Absolute Match can often result in no master record being identified since the record has to match every rule listed, so in most cases, you should select Priority Match.

Step 4: Control What Field Data is Retained

Though it's possible that duplicate records may be exactly the same, often there is only partial data overlap between them. When data is split between two different records, both records may contain unique and important information about the customer you'd like to keep.

By default, Insycle will keep the master record values; if the master field is blank, the value from the most recently updated duplicate will be used. The Merge Duplicates module allows you to control the values saved in the master record after the merge, regardless of the default merge behavior. By adding each field you want to control the data retention for in the Fields tab under Step 4 and selecting a Criteria, you can tell Insycle where the data for the field should be taken from and how to handle it.


On the Fields tab under Step 4, the Criteria dropdown gives you various options for choosing the data to keep, and Group Fields lets you keep values of multiple fields from the same record:

  • From master record – Use the value that exists in the master record.
  • From master record (even empty) – If the field on the selected master record is blank, keep it that way. Don’t automatically fill it in with a value from the most recently updated record.
  • Most frequent value* – If the same value appears in multiple records, use the one that appears most frequently.
  • From record where value – Select data from one of the records in the duplicate group based on the values. These options vary depending on the field type. For example, retain the data from the Number of Employees field that has the highest value.
  • From record based on other field value – Look at the value in a different field to decide which value from the duplicate group should be kept. The example above highlights how a Last Modified Date value can be used to determine which Account Owner value to use.
  • Combine and append all values* – You can merge the values from the selected field for all records in the group. For example, if there is some type of Notes field, you could keep the notes from all of the records in the duplicate group.
  • Collect all values from other field* – Select a destination field to copy and combine values into, then select what field the data should come from for each record in the duplicate group. For example, this could be used to keep the read-only Record ID values of all duplicates in a group and combine them into a custom field.
  • Collect non-master values from other field* – Aggregate the values of all the duplicates that are not the master and not the same as the master, meaning all instances of that value are excluded from collection. This can be especially helpful if you want a record of the object IDs that were removed, so you can also remove them from another system. Select a destination field to copy and combine values into, then select what field the data should come from.

* Indicates Criteria options that do not allow you to Group Fields.

For instance, if you want to preserve the record IDs of the duplicates that are merged into the master record, you can create a custom field, "Merged Record IDs,” in your CRM.

Then, in the Merge Duplicates module, under the Fields tab of Step 4, add a rule to override the default merge behavior. Select the "Merged Record IDs" field you created, the "Collect all values from other field" criteria, and "Record ID" as the other field. 


You can use the Preview CSV to see how this will preserve the Record IDs of all the duplicates in each duplicate group.


You could set multiple criteria for the same field, which can be useful when establishing a hierarchy for selecting the value so "Value A" takes precedence over "Value B."

In this example, two different rules are defined for the 'Lifecycle Stage' field. The first rule states that if a record has the value "Customer," that value will be merged into the master record. However, if no records match the "Customer" criteria, the second rule for "Opportunity" comes into play.


Step 4: Adding Extra Fields to Your CSV Export

When in doubt about what will wind up in your master records after the merge, add the important fields as additional rules on the Record tab. Then use the Preview CSV created in Step 5 to review how the values will merge.

Adding fields to master selection rules

Granular Control for Picking Duplicate Records

For situations where there are no common rules you can apply for identifying duplicates for all or some of the records, you may need more granular control for picking records to include or exclude from the process.

To do this in bulk, you can create a CSV and use the Magical Import module.

In these cases, you can use CSV files to customize your bulk merging, designate master records, and exclude records from deduplication. Then you can import the CSV from the Magical Import, and use the Merge Duplicates module for complete control over the final merge operation. Learn how to customize merging Duplicates in bulk using a CSV.

To do this one record at a time, you can use Manual mode of the Merge Duplicates module.

In Manual mode, you have complete control over which records are merged together by selecting them from the Record Viewer. Manual mode should be reserved only for cases needing a careful, controlled process. Learn more about merging duplicates in Manual mode.


Insycle isn't finding any duplicates

Most of the time, when Insycle can't find duplicates, it is due to your matching rules in Step 1. It is important to analyze the underlying data to better understand how to set up your rules. A useful exercise can be to set up a simple filter to look for exact matches of Website or Company Domain Name.


When you click Find, these rules can show you a broad overview of what duplicates are potentially in your database and what fields might be useful to include in your matching fields. These settings are just for discovery and should not be used for a final merge operation; many people can have the same first and last names and are not duplicates. 

To get further context, on Step 2, click the layout gear button on the right side of the title bar. Here, you can add any field in your database as a column to the duplicate group review to better understand the data inside these records.

Gear button

"Change rules in Step 4 'Master Selection'" Message in CSV

If the Message column of the CSV report displays this text:

Change rules in Step 4 'Master Selection'. Failed to pick master record because multiple records (X) meet the selection criteria. In 'Master Selection', change, add, or reorder the rules such that only one record matches (if cannot determine master based on field values, use 'Record ID is lowest' as the last rule).


This means that based on all the rules, Insycle could not figure out which record in the duplicate group would be the master. None of the records meet more of the rules than others.

There are a few things you can try to resolve this:

  1. Under Step 4, on the Record tab, experiment with reordering or adding additional fields that are likely to have unique values.
  2. In the Step 4 heading, check to ensure that you have Priority Match selected and not Absolute Match.

    With Priority Match, your master record only has to match one rule. Using Absolute Match, your master record would have to meet all of the rule criteria. The majority of the time, it is best to select Priority Match.

    If Priority Match was used, then none of the records in the duplicate group meet any of the criteria on the list more than the others. In this case, you'll need to experiment with the Record tab, reordering or adding additional rules for fields likely to have unique values.

  3. As a last resort, you can add a rule on the Record tab of Step 4 that says Record ID is lowest or Create Date is earliest.
It's taking a long time for Insycle to find duplicates

It can take a while for Insycle to find and match duplicates if the fields being used to identify them have very long values. The longer the values, the longer it takes Insycle to process the data and generate the results. This might come up when looking for matches based on long ID numbers, LinkedIn bio links, or other URLs with long strings attached (ex,

You can speed this up by limiting how much of the value Insycle looks at.

If the beginning or ending portion of the values are all unique, you can limit the comparison to the first or last several characters using the Match Parts parameter under Step 1



Or use the Ignore Text (Substrings) parameter, then click the Terms button.


On the Ignored Text tab of the popup, add the common portion of the URL or text string.


Frequently Asked Questions

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

Yes. With Insycle, you can first deduplicate in Salesforce, then deduplicate in HubSpot using the Salesforce Account ID field to match the master record, all while the sync is active. 

If you were to try to merge companies within the HubSpot application, it won't work when the sync is active.

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

Yes, because HubSpot doesn't let you merge companies when the sync is active, it is best to deduplicate in Salesforce first, and then follow the steps laid out in this article to ensure that the duplicate companies are also removed in HubSpot.

Does HubSpot allow you to merge companies while the sync is active?

No. HubSpot doesn't let you merge companies from the HubSpot application when the sync is active, but Insycle does.

How does Insycle pair the master record between HubSpot and Salesforce?

When you deduplicate Salesforce accounts first, you can look for records with a Salesforce Account ID when you deduplicate HubSpot companies. 

As long as you deduplicate Salesforce accounts first when you deduplicate HubSpot companies, you can look for records that have a Salesforce Account ID. Since the Salesforce records have already been merged, there will only be one left with a Salesforce Account ID. The HubSpot records that have this match the master record in Salesforce. 

I used the “From master record (even empty)” retention rule. Why does HubSpot say Insycle deleted it?

When merging HubSpot contact records using the “From master record (even empty)” data retention rule, the property history in HubSpot shows that Insycle set the value to “empty.” This is a nuance of how HubSpot manages the history of empty values. You can verify that the master record value before the merge was indeed empty by reviewing the Activity Tracker report in Insycle.

Some of my HubSpot duplicates have attachments, will these be preserved?

Yes, if your HubSpot objects have attachments, they will be merged into the master record. Note that there may be a short delay before the attachment appears in the merged record.

Additional Resources

Related Help Articles

Related Blog Posts