The independent daily for Salesforce admins, developers and architects

Curated by Abhinav (opens in a new tab)

Checking Contact parent accounts after a Salesforce data migration (opens in a new tab)

You will learn why matching field values is not enough to verify a migration, and how to test each Contact's parent Account through a stable external key, using either pandas or Google Sheets formulas.

  1. Source Contact to its source Account ID
  2. Source Account ID to its stable key
  3. Target Contact to its target Account ID
  4. Compare the two Account keys
The check follows each Contact's parent Account through the stable key to the target org

A Contact can keep its name and email after a migration and still be attached to the wrong Account. Comparing field values will not catch this, and record IDs usually change between orgs, so they cannot be compared directly either. The article proposes a stable key, such as an External ID field, that identifies the same Account in both exports. The check follows the Contact’s source Account to its key, then confirms that the target Contact’s Account has the same key.

The article works through a small set of invented example CSVs. A pandas script merges the Contacts, maps each parent through the keys, and flags a WRONG_PARENT result for one Contact whose target Account points to the wrong record. The same logic is then rebuilt as Google Sheets formulas using INDEX and MATCH, with uniqueness checks on the keys and an EXACT comparison because MATCH is case-insensitive.

The author notes practical cautions for real exports. Lookups that return errors should be investigated rather than hidden with IFERROR, and the ranges must be widened for larger files. The check only verifies the relationships in the files loaded, so it does not certify a whole migration.

Read the original at dev.to (opens in a new tab)

Worth reading?