OBLYTECH Logo
OBLYTECH Logo

Lookup Relationship Mapping for Migrated Records

Lookup relationship mapping for migrated records is the step that links each child record to the parent it belongs to, using identifiers carried over from the source system. Done in the right order, with parents loaded before children, the references resolve on arrival and no one has to repair them by hand after the load.

Why parent records must exist before their children

A child record cannot point at a parent that does not exist yet. When a migration loads contacts before the accounts they belong to, each contact arrives with a blank or wrong reference, and the repair is usually a second pass that touches each affected row. The load order follows the dependency chain, not the order in which the source files happen to arrive, so map that chain before anyone loads a file.

Start by listing each object you are moving and noting which of its fields point at another object. Those lookup fields define the graph. A simple case runs from accounts to contacts to cases. A harder case includes junction records, account hierarchies, and records that refer back to something loaded later. Each of those needs a deliberate position in the sequence.

Write the chain down as a short list with four items per object: the object name, the reference field, the parent object, and whether the reference is required. Required references are the ones that block a load. Optional references can usually be filled in during a later wave without stopping anything.

Preparing source keys before the first test load

Source keys decide whether matching works at all. Before the first test, pull a sample of each key column and look for the problems that cause silent mismatches: leading or trailing spaces, letter case that differs between extracts, identifiers stored as text in one file and as numbers in another, and leading zeros that a spreadsheet may have removed. A key that repeats within one object can attach a child to the wrong parent without any error unless the target rejects duplicate keys, so count distinct values against total rows before building the mapping table.

Building the mapping table from source keys

The mapping table records how each old identifier became a new one. It has one row per migrated record and at least three columns: the source object name, the source key, and the target identifier assigned by the load. Relationship mapping depends on this table, because a child row cannot find its parent without knowing which new identifier stands in for the old one.

Keep the table in the project file, not in a person’s local copy. Fix its format before the first test so each wave writes to the same structure. Add a status column so each row can be marked loaded, failed, excluded, or held, and so a rerun knows which rows to skip.

Sequencing the load so references resolve on arrival

Once the dependency chain is written down, the load plan becomes a list of waves. Wave one holds objects with no required parents. Wave two holds objects whose required parents all came from wave one, and so on. Records that refer to each other in a loop need a separate step, covered later in this guide.

Within a wave, load in a fixed order and use the same batch size across runs, so a failure can be traced to a known set of rows. Log the source key, the target identifier, and the status for each row. A log that shows the parent result beside each child result turns the reference fill into a lookup rather than an investigation.

  1. Load parent objects in dependency order and record each new identifier against its source key.
  2. Stage child files with the parent reference column holding the source key, not the target identifier.
  3. Resolve each source key to its target identifier from the mapping table just before the child batch loads.
  4. Load the child batch and write each result back into the log.
  5. Pause the wave if the failure rate passes the threshold agreed before the run, and fix the cause before continuing.

Staging child files with source keys instead of target identifiers is the step teams often skip. It lets you rerun a child wave without rebuilding files by hand, because the mapping table can be rebuilt from the logs of earlier waves. For help planning this work, see Salesforce implementation.

One pass or two passes

A one pass load works when each required parent sits in an earlier wave than its children and no record points forward. A two pass load creates the records first with the reference fields empty, then fills those references once all targets exist. The second pass takes longer, but it handles cycles and forward references cleanly. Choose the method per object rather than once for the whole migration.

Running a rehearsal load before cutover

A rehearsal runs the full sequence against a copy of the target, using an extract that matches the one planned for cutover. It shows whether the mapping and ordering hold before live data is involved. Treat the first rehearsal as a test of the method rather than of the data, and expect to run it more than once.

  1. Refresh the extract and confirm the row counts against a count taken from the source.
  2. Run the wave plan into the copy and capture the log for each wave.
  3. Compare the attached child counts for a sample of parents against the source.
  4. Correct the mapping or the file for each defect, then rerun from the first wave that changed.
  5. Repeat until a full run finishes with the agreed reference results and no open defects.

Checking the references after each load wave

A load that reports success shows that the rows were written, and nothing more. Check the references before the next wave starts, because a wrong parent found later means unwinding the children that already attached to it.

Run three checks after each wave. First, count the child rows with an empty parent reference and compare that count with the number of children the source expected to attach. Second, sample rows and confirm that each parent’s source key matches the source system’s parent for the same record. Third, confirm that no child points at a parent from a later wave.

The checks matter sooner for relationship-heavy data. A household attached to the wrong adviser shows up in client review preparation as a gap in the client’s history, and that gap tends to surface before any report does.

Reconciliation before sign-off

Summary counts catch missing rows but not swapped ones. Pick ten to twenty parents across the range of sizes in your data, including the largest and the smallest, and compare the children attached to each in the target with the same parent in the source. A swap usually shows as a parent with too many children beside a neighbor with too few.

Activity-linked objects need their own sample. Account health views depend on activity attached to the right account, so after any load that moved activity records, compare a sample of accounts against the source. Forecast totals follow the same logic. Opportunities under the wrong account distort the figures a pipeline forecast review relies on, so test the opportunity-to-account links before that review uses them.

Handling orphans and cycles

An orphan is a child whose source parent was not migrated, because the parent was out of scope, was deleted in the source, or failed to load. Settle the rule before the first wave: leave the reference empty and flag the row, hold the child back, or attach it to a named holding record that the business owns. Each rule carries a different cleanup cost later.

Cycles appear when two records point at each other, such as an account that names a partner account which names it back. Ordering alone cannot resolve a cycle. Create one side with the reference empty, load the other side, and then fill the empty reference in the second pass.

Questions about lookup mapping after a migration

What should the mapping table hold for records deleted in the source?

Keep a row for the deleted record with its source key, a status of excluded, and no target identifier. Children that point at it follow your orphan rule. The row lets you answer a later question about why an old identifier does not resolve, without searching through old extracts.

How long should the mapping table be kept after cutover?

Keep it for as long as anyone may need to trace an old identifier, which usually means as long as the source system’s data is retained. Agree the period with the people who own the data. At cutover, archive a read-only copy so reconciliation stays possible after the source is switched off.

Who should sign off the reference checks?

Give the technical checks to someone who knows the data model and can explain the load log. The data owner should sign off the business meaning of the results, and the migration lead should sign off the counts. Two sign-offs stop a technical match from being accepted as a business match.

Should users keep editing records during the load?

Freeze changes to the objects in scope for the length of the load, or capture the changes made during the run as a delta and apply them afterwards. Edits made to a parent during a child wave can change the fields the mapping relies on, such as a status or a key, so the mapping table then describes a record that no longer matches the source.