The independent daily for Salesforce admins, developers and architects

Curated by Abhinav (opens in a new tab)

Recommended

Upserting Contacts to Accounts with an External ID in Data Loader (opens in a new tab)

You will learn how to set up a unique External ID on Account, load Accounts before Contacts, and map the source key to relate them without a post-load VLOOKUP.

Why read this

You will also see which reference fields cannot be mapped to External IDs and what still breaks.

  1. Create unique External ID on Account
  2. Back up and test a small subset
  3. Upsert Accounts
  4. Upsert Contacts, mapping Account:External_ID__c
The order of operations for relating Contacts to Accounts by External ID

Relationships in Salesforce are stored as record IDs, so a source system’s Account key in a Contact file cannot be used as AccountId. The walkthrough follows Salesforce Help: create or reuse a unique External ID field on Account, load Accounts first (insert, or upsert for reruns), then upsert Contacts and map the source-key column to the Account:External_ID__c field.

The steps include backing up and testing with a small subset, and the Data Loader wording is quoted from Salesforce Help rather than a live run. The example data is invented and was not loaded into an org. A Contact whose key is missing from the Accounts will fail, and that failure appears in the error file.

The piece lists the main failure causes: blank or non-unique External IDs, child rows loaded before the parent, and Lookup Filters or Validation Rules. It also notes that Polymorphic Fields and a Custom Object’s Owner cannot be mapped to External IDs, and that a successful upsert does not prove the source key was correct.

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

Worth reading?

Checking a Contact export for orphans, duplicate External IDs and picklist mismatches after a load (opens in a new tab)

You will learn how to count orphaned Contacts, unresolved AccountIds, duplicate External IDs and picklist values outside the allowed API names, using spreadsheet formulas, a standard-library Python script and SOQL.

Why read this

The article also explains what these checks cannot catch.

  1. Export Contacts and Accounts
  2. Flag blank and unresolved AccountIds
  3. Find duplicate External IDs
  4. Compare picklist to allowed API names
Four checks run on the exported files after a load

A successful Data Loader insert or upsert can still leave a Contact export with problems the success file does not show. The article covers blank AccountIds, AccountIds that point to no Account in the export, External IDs shared by more than one Contact, and picklist values that are not among the field’s allowed API names.

The walkthrough works through example files and three methods: spreadsheet formulas that flag each problem column, a Python script using only the standard library, and SOQL queries to confirm the counts against the live org. It notes that SOQL returns picklist API names rather than labels, and that values loaded into an unrestricted picklist can be stored without being listed in Setup.

The author stresses that orphans are a review list rather than a delete list, and that a wrong but existing AccountId needs a separate source-to-target comparison. The example data is fabricated and the reader must adapt field headers to their own org.

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

Worth reading?

Recommended

Reconciling record Counts and field values before a Salesforce go-live (opens in a new tab)

You will learn a spreadsheet-based method for proving a Salesforce data migration is complete and accurate, using external keys, SOQL counts and totals, and case-sensitive value comparisons.

Why read this

You will also see how to tell nulls and truncation apart from other mismatches.

  1. Reconcile record counts per object
  2. Compare totals on amount fields
  3. Compare field values on an external key
  4. Sign off each object
The migration check runs in four steps, from counts to sign-off

A load that finishes without errors only shows that Salesforce accepted the rows sent to it. It does not show that every source record arrived or that the values arrived unchanged. The article sets out a check per object that compares record counts with SOQL, excluding records created by hand in the sandbox and records left out on purpose, and reports the difference in a status column.

Count matches are not enough on their own, so the author compares summed amounts per object and per StageName group, including the handling of corporate-currency totals in multi-currency orgs. Field values are then matched on an External ID using INDEX and MATCH, with EXACT used for a case-sensitive comparison and a sample taken for large objects. Nulls and truncation are flagged separately, because they have different causes and fixes.

The article closes with a per-object sign-off table that can only read Ready when counts, totals and value checks all pass, with a Counts only status for objects whose values have not been checked. The formulas were tested in LibreOffice Calc and are noted as untested in Excel and Google Sheets.

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

Worth reading?

Recommended

Finding hidden duplicate accounts after a Salesforce Data migration (opens in a new tab)

You will learn how to normalise legacy keys, count duplicates in a spreadsheet and in SOQL, separate true duplicates from key collisions, and repoint child records before deleting a duplicate Account.

  1. Normalise the legacy key
  2. Count raw and normalised keys
  3. Classify each duplicate group
  4. Repoint child records
  5. Delete the duplicate
The duplicate clean-up sequence for migrated Accounts

Matching record counts after a migration can hide duplicates. Re-run loads, insert calls used where an upsert on an External ID was needed, and keys that differ only by case, spaces or leading zeros all leave duplicates behind. Salesforce duplicate and matching rules do not examine a legacy key unless a rule is built for it.

The article walks through normalising the key with spreadsheet formulas, counting raw and normalised keys, and classifying each group as unique, exact duplicate, hidden duplicate or key collision. A SOQL GROUP BY query with HAVING clause provides the same check inside the org, though it catches case differences only, not leading zeros or trailing spaces.

Before deleting anything, the author chooses a survivor, usually the Account with the most Contacts, and repoints Contacts, Opportunities and Cases to it with Data Loader or the Account merge operation. The checklist ends with marking the External ID field Unique so the next load cannot insert the same key twice.

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

Worth reading?

Detecting wrong-parent Contacts after a migration using External IDs and SOQL (opens in a new tab)

You will learn how to test whether Contacts still point to the correct Account after a migration, using External ID keys, a child-to-parent SOQL export, and a source-to-target comparison.

Why read this

The method works with native tools and needs no third-party code.

  1. Confirm keys are unique
  2. Export Contacts with parent key
  3. Match Contacts on their key
  4. Compare Account keys
The wrong-parent check compares Account keys for each Contact across two orgs

Record Ids usually change between orgs, so comparing AccountId values across a migration tells you nothing. The article proposes a stable External ID on both Account and Contact, then checks that the parent Account’s key is the same on each side for every Contact.

The workflow starts with uniqueness and blank-count queries on the keys, then uses a single child-to-parent SOQL export from Contact via Data Loader to pull Account.External_Key__c onto each row. The same view can be built as a Contacts & Accounts report. Rows are then matched on the Contact key and the Account keys compared, with blanks flagged as unresolved and missing rows reported separately.

The author notes limits: the method needs a shared stable key, Data Loader does not support nested subqueries, and a clean parent check does not validate field values, sharing or record types. The article is written by the vendor of a paid CSV comparison tool, which it discloses.

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

Worth reading?

Recommended

Finding missing and duplicate records after a migration by matching external keys (opens in a new tab)

You will learn a method to reconcile two CSV exports on a shared External ID, using spreadsheet formulas to flag records that are missing, extra, duplicated or have blank or mismatched keys.

Why read this

You will also see why to check parent objects first.

  1. Export source and target with the shared key
  2. Count blank and duplicate keys per sheet
  3. Match each row in both directions
  4. Review missing, extra and duplicate statuses
  5. Repeat per object, parents first
Reconciling source and target exports by external key, in order

After a migration, record counts can look right while hiding records that never arrived, records loaded twice, and records with no source. The article argues that the Salesforce Id cannot be used for matching because it is regenerated on insert, so you need a key present on both sides, such as a legacy ID held in an External ID field like Legacy_ID__c.

The method uses two exports and a spreadsheet. Keys are first checked for blanks and duplicates with a case-sensitive EXACT-based count, since COUNTIF ignores case. A status formula on each sheet then labels each row as OK, Missing in target, Extra in target, Duplicate key, Blank key or similar, which is checked in both directions so that a duplicate in the target shows up only when both sides are compared.

The author recommends running this per object, starting with Accounts and then Contacts and Opportunities, because a missing parent explains gaps underneath it. The method does not compare field values or verify parent relationships; the article points to separate posts for those checks and mentions a paid tool it sells.

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

Worth reading?

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?

Must-read

Migrating HubSpot to Salesforce: External IDs, upsert, and load order (opens in a new tab)

Readers will learn how to structure a reliable HubSpot to Salesforce data migration using External IDs, proper load ordering, and Bulk API, including strategies for handling hierarchies, deltas, and validation.

  1. Cleanse data and map picklists
  2. Dry run in sandbox with disabled automations
  3. Load records following dependency order
  4. Enable read only mode and run delta load
  5. Verify record counts and relationship integrity
Phased migration process from HubSpot to Salesforce

The article addresses the complexity of moving historical records and relationships from HubSpot to Salesforce, emphasizing that simple export import fails due to differing data models. It establishes the External ID field as the foundation for tracking records, enabling idempotent upserts, and linking related objects without relying on Salesforce generated identifiers.

It outlines a strict dependency sequence for loading records, starting with Users and Accounts before moving to Contacts, Opportunities, and Activities. Special attention is given to Account hierarchies, recommending a two pass approach to avoid parent child reference errors. The piece includes a Python example using the Bulk API to demonstrate upserting an Opportunity by matching its Account via an External ID rather than a native Salesforce identifier.

Before migration, the author stresses data cleansing, deduplication rules, and mapping picklist values like pipeline stages. A sandbox dry run is recommended to generate repeatable error reports and to temporarily disable automations such as Flow and Apex triggers that could trigger unwanted side effects during bulk loads.

The final phase uses a delta load strategy to capture changes made after the initial bulk transfer, requiring source system read only mode and timestamp tracking. Post migration validation involves comparing record counts, verifying relationship integrity, reconciling financial totals, and spot checking field values to ensure data accuracy before full team adoption.

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

Worth reading?