OBLYTECH Logo
OBLYTECH Logo

Data Import Preparation: Cleansing Records Before a Load

Before a Salesforce data load, cleanse the source records in a fixed order: confirm the field mapping, check picklist values against the target, remove and merge duplicates, standardize formats, then run a trial load into a sandbox copy. Skipping a step usually shows up later as rejected rows or wrong values in live records.

Why the order of cleansing steps matters

Each step depends on the one before it. Cleaning a column that will not be loaded wastes time, so the mapping comes first. Picklist checks come next, because a value that does not match a target option fails its row no matter how clean the rest of the row is. Duplicate matching comes after formatting, since two records with the same email address but different capitalization or spacing will not match each other until both are normalized. The trial load comes last because it tests every earlier step at once.

Teams that reverse the order often repeat work. A common example is deduplicating a file, then discovering that a mapping change has moved a key field, which means the duplicate decisions have to be reviewed again. Treating the sequence as a checklist with a sign-off at each stage usually avoids that rework. The wider context for these steps is covered in data migration and integration.

Confirm the field mapping before cleaning anything

If the scope of the migration has not been settled yet, the needs assessment should come first, because it decides which objects and fields are in scope. Once scope is fixed, build a mapping sheet that lists every source column against a target field, the data type on each side, and whether the target field is required.

What to record for each mapping

  1. The source column name and a sample of three to five real values.
  2. The target object and field name, or a note that no target exists yet.
  3. The data type and length on both sides, so text is not truncated without anyone noticing.
  4. Whether the field is required, and what the load should do when the source value is blank.
  5. A named owner who can explain what the field means in the source system.

Fields with no target are a decision point rather than a cleansing task. The field either gets a new home, is archived in a separate file, or is dropped with sign-off from the business owner. Cleaning data for a field that is later dropped is wasted effort, and a field that is kept without a target tends to cause confusion after go-live. Record the decision next to the mapping row so the reason is still visible months later.

Check picklist and lookup values against the target

Picklist values are a frequent cause of rejected rows in a first load. Source systems often hold labels that look identical to a person but differ to a database, such as a trailing space, a plural, or an abbreviation. Compare the distinct values in each source column with the values the target accepts, then decide how each source value maps.

Working through a value crosswalk

  • Export the distinct values for each picklist field, with a count for each value.
  • Map every source value to one target value, or mark it as an exception for review.
  • Check the target for options that have been retired, because these are easy to overlook when the label looks right.
  • Agree who decides the mapping for ambiguous values such as “Other” or “TBD”.

Lookup fields need the same treatment. A lookup is only as reliable as the match key used to find the parent record. If the key is a name, expect collisions between records that share a name but not an identity. If the key is an external identifier from the source system, confirm that the identifier is populated and unique before the load begins, and list any parent records that cannot be matched so they are resolved before the child rows are loaded.

Standardize formats and resolve duplicates

Standardization comes before duplicate matching. Trim leading and trailing spaces, normalize letter case where the target expects it, convert dates into one format, and store phone numbers and country names in a single convention. Doing this first means the duplicate rules compare like with like, rather than treating two copies of the same customer as different because one has a stray space.

Setting duplicate rules for the file

Decide the match keys before looking at results. A strong key is an identifier that already exists in the source, such as an external ID or a unique account code. Where no such key exists, a combination like a normalized email address plus company name is usually more reliable than name alone. Record each decision in writing, because the same rule later explains why two records were merged or kept apart.

When two records match, choose a survivor record and decide which fields it keeps. Keep a cross-reference table that maps every source identifier to the target record it became. Without that table, child records and follow-up corrections are difficult to attach correctly after the load, and a support question about one customer can take hours to trace.

Run a trial load on a sandbox copy

A trial load tests the cleansed file under realistic conditions before anything reaches the live org. Use a sandbox copy that is recent enough to reflect the current configuration, so validation rules and required fields match production as closely as possible. Plan the copy timing with the sandbox refresh planning work, because a stale copy can pass a trial load that then fails in production.

What to check after each trial run

  1. Row counts in the file match the counts in the target, with every reject accounted for.
  2. The error log is grouped by cause, and each group has a fix or a documented decision.
  3. Parent and child records are linked correctly, spot-checked against the cross-reference table.
  4. Formatted fields such as dates, currency amounts and phone numbers show the values the business expects.
  5. Automation that runs when records are created does not change loaded records in ways nobody planned for.

Run the trial load more than once. Fix the file, reload the sandbox from the same starting point, and repeat until the error groups are down to decisions the business has accepted. Keep the logs from each run, because they become the evidence for the go or no-go decision. A run that produces the same errors twice usually points to a mapping or crosswalk problem rather than a data problem, so return to the earlier sections before trying a third time.

Assign roles and sign-off before the production load

The cleansing work usually needs three roles with different jobs: a data owner who knows what the values mean, an administrator who knows the target configuration, and a reviewer from the business who signs off the results. The administrator confirms whether a picklist value can be added to the target or must be mapped to an existing one. The data owner decides the mapping for ambiguous values. The reviewer checks that the trial results match what the business expects to see in the org.

Before choosing how to move the file in, compare the loader tool options against the volume of records and the team’s experience, because the team should know how errors will be reported and how a failed batch gets rerun before committing to one. Then write the sign-off criteria down, including the rejected-row count the business will accept and who makes the decision if that count is exceeded. For help planning this work, see Salesforce implementation.

Questions about cleansing before a Salesforce data load

How long does cleansing usually take before a load?

It depends on the volume of records, how many sources feed the load, and how many decisions the data owner has to make. Picklist mapping and duplicate review often take the longest, because they depend on people reviewing judgment calls rather than on rules that run on their own. Plan for several rounds of trial loads rather than a single pass, and build the schedule around the sandbox refresh dates.

Should cleansing happen in the source system or in a spreadsheet?

Cleaning in the source system is the better choice when that system stays in use after the migration, because the fix also improves data entered in the future. A spreadsheet or staging file suits a one-time move, provided the file keeps the source identifiers so each change can be traced back. Whichever route you take, keep the original extract unchanged so the work can be repeated.

Do records that will not be imported need cleansing?

They do not need cleansing, but they do need a documented decision. Records excluded by a filter should be counted and listed by the filter criteria, so the business can confirm that the exclusion is intended. Excluded records are often the ones people ask about after go-live, and a short written record of the criteria usually answers those questions without a search.

What is the difference between a trial load and a full rehearsal?

A trial load tests the file in a sandbox to find errors, and it can run on a sample or a complete set. A full rehearsal repeats the entire production sequence, including the timing, the cutover steps and the post-load checks, so the team knows how long the real run will take. Teams often run trial loads first and schedule the rehearsal once the error groups are closed.

What should be kept after the load finishes?

Keep the original extracts, the mapping sheet, the crosswalk of source to target identifiers, the final error log and the sign-off record. Together these documents let the team trace a single record back to its source, explain merged or excluded records, and rerun a correction if a problem appears later. Store them where both the data owner and the administrator can find them without asking.