What to clean before a CRM or ERP migration

Moving to a new CRM or ERP breaks parent-child account links and strands orphan contacts. Here is how snapshot dry-runs protect historical data.

Your operations team has spent six months scoping a new enterprise CRM. The vendor has configured the dashboards, mapped the sales stages, and trained the staff. Everything is ready for the weekend cutover.

On Saturday morning, the IT team runs the database export from the old system and attempts to import it into the new one. The script throws three thousand errors within the first minute and halts. By Sunday night, the team is manually fixing spreadsheets. On Monday morning, the sales team logs in to find their accounts are missing, their historical notes are scrambled, and regional branches have been disconnected from their parent companies.

Migrating a CRM is not a software project. It is a data engineering project.

The software vendor will tell you their import tools are seamless. What they do not mention is that their tools assume your legacy data is perfectly structured. If you have spent the last five years letting your sales team type whatever they want into text fields, your data is not structured. If you try to migrate a messy database without cleaning it first, you simply copy your old operational problems into an expensive new system.

The mechanics of a failed migration

When a legacy database fails to migrate cleanly, it almost always fails on relational integrity. A modern CRM expects data to be neatly organised into interconnected objects: a Company object, connected to multiple Contact objects, connected to multiple Deal objects.

Over years of real-world use, users break those connections.

First, there is the problem of orphan records. A sales rep decides to \"clean up\" their pipeline by deleting an old Company record. But the legacy system allows them to delete the Company while leaving the three associated Contacts untouched. Those Contacts are now orphans. When the new CRM attempts to import them, it asks, \"Which company do these people belong to?\" When the answer is blank, the CRM rejects the import.

Second, there is the parent-child collapse. B2B commerce relies on complex hierarchies. A major construction firm might have one corporate head office that pays the bills, and fifty regional sites that place the orders. In the old system, reps simply named them \"Firm HQ\" and \"Firm London Branch\". If you export those as flat records without explicitly defining a Parent_Account_ID, the new CRM treats them as fifty-one completely unrelated businesses. Your credit limits break, and your reps start pitching the branch instead of the head office.

Third, there is the problem of historical duplication. Your old database probably has three different records for the same client, created by different reps over the years. If you migrate all three, you guarantee that the new system will trigger duplicate lead routing and confuse your marketing automations on day one.

Worked scenario: auditing 10,000 legacy records

Say a wholesale merchant is migrating 10,000 legacy records to a new enterprise CRM. Instead of crossing their fingers on launch day, they run a snapshot dry-run to identify the errors hiding in the database (illustrative figures to demonstrate the mechanics).

Here is what the dry-run catches before the weekend cutover:

Data Failure CategoryRecords AffectedLegacy System ConditionCommercial Consequence if Migrated Blindly
Orphaned Contacts1,200 contactsSales reps deleted the Company record but left the Contacts attached to nothingContacts fail import validation; historical conversation context is lost forever
Collapsed Parent-Child Branches850 branch accountsSystem relied on identical names instead of parent Account_ID keysCentralised billing fails; sales reps pitch the same parent account multiple times
Duplicate Tax/VAT Keys340 accountsTwo reps created the same business under slightly different namesCredit limits are applied to the wrong entity, causing order processing delays
Inactive Historical Records850 accountsBusinesses that ceased trading five years ago remain activeThe new CRM is immediately cluttered with dead leads, frustrating the sales floor
Total Pre-Migration Repair Load3,240 records (32%)Poor historical data hygiene masked by legacy UIIf migrated live, the new CRM would fail on day one

Nearly a third of the database required repair. If the business had attempted a blind migration, 3,240 records would have either failed to import entirely or created immediate operational chaos for the sales team.

Diagnostic patterns of messy data

When a database lacks strict field contracts and regular maintenance, the symptoms are obvious in how the business operates:

What your systems showWhat is happening technically underneathCommercial consequence
Import scripts fail with \"Foreign Key Constraint\" errorsYou are attempting to import an Order or Contact linked to an Account that no longer existsCutover weekend extends into Monday, leaving the business unable to process sales
Branch offices are assigned independent credit limitsThe flat CSV export stripped the parent-child relationship keysThe business extends dangerous levels of credit to a single corporate entity
Sales reps complain the new system is missing their notesActivity timelines failed to map to the new CRM's unique object architectureSales team loses trust in the new system and refuses to adopt it
Marketing emails hard bounce heavily post-migrationYou imported five years of stale, unvalidated contact dataYour sending domain reputation takes an immediate hit

Running the snapshot dry-run

You protect the business from a migration disaster by completely separating the data cleanup from the final cutover. You do this through a snapshot dry-run.

Four weeks before the launch, you export a complete snapshot of the legacy database. You load this data into a secure staging environment or a sandbox version of the new CRM. You then write the transformation scripts necessary to map the old fields to the new architecture.

When you run the script in the staging environment, it will fail. This is the entire point of the exercise.

The staging environment generates an error log detailing exactly which records broke the rules. You take this error log to the sales and operations teams. You ask them to identify the parent companies for the orphan contacts. You ask finance to confirm which duplicate account holds the correct credit limit. You write rules to archive any business that hasn't traded in five years.

Once the rules are established, you run the dry-run again on a fresh snapshot. You repeat this iterative process until the staging environment accepts the data with zero critical errors.

When cutover weekend arrives, you are not testing a theory. You are simply executing a script that has already proven it works. The data imports cleanly, the parent-child hierarchies snap into place, and the sales team logs in on Monday to a system they can actually trust.

Frequently asked questions

Should we manually clean the data before or after exporting it?

You should clean the data in a staging environment or data warehouse, never in the legacy system or the new CRM. Manual edits in a legacy system are risky and undocumented, while cleaning in the new CRM means the bad data has already contaminated the fresh environment. A staging layer allows you to write repeatable SQL scripts that transform the data programmatically.

What is the best way to handle historical emails and activity notes?

Historical activities are the hardest objects to migrate because different CRMs structure timelines differently. Instead of trying to force ten years of messy legacy notes into the new CRM's activity feed, a safer approach is to compile the historical notes into a single, static text block and save it to a custom field called \"Legacy Notes\" on the new account record.

How do we deduplicate accounts during a migration?

Do not rely on company names for deduplication, as \"Smith & Co\" and \"Smith Ltd\" will bypass the check. Deduplicate B2B accounts by matching exact corporate domains or registered tax/VAT numbers. When a duplicate is found, write a rule that preserves the record with the most recent order date and merges the contact lists.

How far back should we migrate historical data?

Migrating dead data serves no commercial purpose and increases storage costs. Establish a strict cut-off rule: if an account has not placed an order, opened an email, or had a logged sales call in the last three years, flag it as inactive. You can archive these records in a cold-storage database for compliance, but keep them out of the new CRM.

Why do foreign key constraints break CRM imports?

A foreign key is a strict rule that says \"Contact A belongs to Company B\". If the import script tries to load Contact A, but Company B has not been created yet (or was deleted in the legacy system), the database rejects the contact to prevent orphaned data. Import scripts must always load parent objects (Companies) before child objects (Contacts or Deals).

Related reading