The independent daily for Salesforce admins, developers and architects

Curated by Abhinav (opens in a new tab)

Must-read

Reconciling record counts and parent relationships after a Salesforce load (opens in a new tab)

You will learn how to reconcile source and target row counts for each object using Data Loader's success and error files, and how to find children with blank parent lookups or missing children per parent using SOQL.

Why read this

The examples are illustrative and were tested in LibreOffice Calc.

  1. Count success and error rows
  2. Compare with source and target COUNT()
  3. Count children with blank parent
  4. Compare children per parent
Reconciliation sequence for a finished load, from object counts to per-parent checks

After a Data Loader or Bulk API job finishes, a load can be short on rows or leave parent lookups blank even when every child is accepted. The article suggests reconciling counts per object using the job’s success and error files, along with the JobInfo fields numberRecordsProcessed and numberRecordsFailed when the Bulk API is used. It then compares those numbers with a SOQL COUNT() on the target object, and shows spreadsheet formulas to check that success plus error matches the source and that the target matches the success file.

The second step checks whether parents resolved. A SOQL COUNT() with a WHERE clause on a blank lookup field shows how many children have no parent, and a relationship query reads the parent name to inspect those rows. The author notes that a blank lookup may be legitimate on an optional field, so these rows should be treated as a review list rather than a failure.

The third step compares child counts per parent between source and target, using GROUP BY with COUNT on a shared external key, since record Ids usually change between orgs. A parent can look correct overall yet be short because some of its children were rejected. The example shows one parent with two children in the source and none in the target, flagged for review.

The article closes by noting that matching counts do not prove each child is attached to the intended parent, and that SOQL can only count records the user can see. It also advises removing personal fields before sharing exports. The piece ends with a promotion for a paid export review service, which is not part of the technique.

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

Worth reading?

Must-read

Checking a Salesforce Data Export is complete before migrating (opens in a new tab)

You will learn how to confirm every archive, object and file arrived from a Data Export and how to reconcile CSV row counts against SOQL COUNT() before a target load.

Why read this

You will also learn the documented gaps, such as excluded Formula Fields and Recycle Bin data.

  1. Download every archive within 48 hours
  2. Confirm each expected object CSV is present
  3. Confirm attachments and files were included
  4. Compare each CSV row count to SOQL COUNT()
A sequence of checks to run on a Data Export before migrating from it

A finished Data Export job does not guarantee a complete file set. Archives can be missing, expire after 48 hours, or be overwritten when a new export is queued, so the piece recommends downloading every zip promptly and counting them against what was saved. It also flags that Sandboxes do not support Data Export and that the scheduling user receives the download email.

The article then covers checking objects and files: forgetting to tick the options for attachments or Salesforce Files leaves files out, Formula Fields and Roll-Up Summary Fields are always excluded, and Data Loader does not obtain physical attachments. Chatter and content files in weekly exports come as MIME files named after the record ID, and Data Loader’s ContentDocument export only returns files the user owns or that are shared directly with them unless Query All Files is granted.

For row counts, the author compares each CSV’s data rows to a SOQL COUNT() run by a user with comparable visibility, matching the export mode to the query, and counting outside Excel for files above about 1,048,576 rows. A worked spreadsheet example with Match and Review status formulas shows how a short Contact file is caught. A matching count does not prove that attachments open or that parent relationships are correct.

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

Worth reading?

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?

Recommended

Finding Contacts with a blank AccountId after a Salesforce migration (opens in a new tab)

You will know how to find Contacts with no Account using SOQL or a report, why such Contacts are private by default, and how to triage them before attaching any of them to an Account.

  1. Query Contacts where AccountId is null
  2. Compare count with source system
  3. Label each row attach, private or investigate
  4. Attach only reviewed Attach rows
  5. Re-run null query and spot-check
Triage steps for orphan Contacts after a load

After a migration, a Contact can keep all its field values and still have a blank AccountId. That is an orphan, which differs from a wrong-parent Contact whose AccountId points at the wrong company. The article notes that Salesforce Help says Contacts not linked to an Account are private, visible only to the owner and to administrators with View All Data or Modify All Data, and not governed by Contact Sharing Rules. It lists example causes such as Accounts loaded after Contacts or a failed parent lookup on insert, while stressing that a blank AccountId is one finding to be assessed rather than a diagnosis.

The query is a SOQL statement filtering on AccountId = null, optionally combined with an External ID field to narrow to migration-loaded records, and a count can be compared with the source system’s count of Contacts without an account. The same set can be produced from a Data Loader export or a standard report. The author recommends a triage step that labels each row as attach, leave private or investigate, never attaching the whole list automatically, matching on Contact Id, and re-running the null query after updates.

The piece closes with its limits: intentional private Contacts are normal, a null check cannot detect a wrong parent, and users without View All Data may under-count what they can see. It also promotes a paid CSV comparison tool for wrong-parent checks.

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?

Must-read

Checking dependent picklist combinations by Record Type before a CSV load (opens in a new tab)

You will learn how to snapshot dependent picklist values per Record Type from the UI API and run a local preflight that flags CSV rows whose controlling and dependent values do not fit the intended target configuration.

Why read this

The piece is clear that findings are review prompts, not proof of import rejection.

  1. Save per-record-type dependent picklist response
  2. Preserve exact API values in the CSV
  3. Run local preflight against saved metadata
  4. Review each non-match row with its owner
The preflight runs in four stages before any row is trusted

The article argues that dependent picklist checks must be made on the pair of controlling and dependent values for the target Record Type, since a value valid in one Record Type may not be valid in another, and checking each column against a global list misses this. It recommends saving the dependent field response from the UI API object-info endpoint for each intended target Record Type, recording the org, API version and access scope, and keeping API values rather than translated labels.

A Python 3 standard-library script is provided that reads the saved metadata and a CSV, then assigns each row a status such as CONFIG_MATCH, COMBINATION_NOT_AVAILABLE, VALUE_NOT_AVAILABLE_FOR_TYPE, UNKNOWN_CONTROLLER or REVIEW_BLANK. The worked example with invented fields shows one match and five rows for review, and the script deliberately treats malformed or incomplete metadata as a review case rather than a pass.

The author is explicit about limits: the snapshot reflects UI-available combinations for the reader’s access, not full server validation, and required fields, Validation Rules, Flows, field-level security and import-path behavior still need separate review. The approach is scoped to a single confirmed controlling and dependent single-select pair.

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?