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?

Fixing common Salesforce Import errors and the surprises that follow a Load (opens in a new tab)

You will learn how to choose between the Data Import Wizard and Data Loader, what the most common import error messages mean and how to fix them, and why duplicate-rule matches and skipped automation can make a successful import look wrong.

Data Import Wizard

  • Runs in the browser from Setup
  • Up to 50,000 records per load
  • Objects the wizard lists in Setup
  • Results in Recent Import Jobs

Data Loader

  • Desktop app, Java 17 or later
  • Up to 150 million with Bulk API 2.0
  • All objects, including Custom Objects
  • Success and error CSV files per run
The Data Import Wizard and Data Loader differ in where they run and how far they scale

The article starts by separating the two import routes. The Data Import Wizard runs in the browser from Setup, suits smaller loads under 50,000 records on supported objects, and is the easier starting point. Data Loader is a desktop application that needs Java 17 or later, covers all objects including Custom Objects, supports upserts, deletes and scheduled command-line loads, and is the route to take when a file outgrows the wizard.

Most failures come from the file rather than the tool. The article walks through the usual causes: a missing required field such as Last Name, values that do not match a picklist exactly, inconsistent date formats, and values longer than the field allows. It explains that duplicate errors can fire against existing Contacts or Accounts because standard matching rules compare names and contact details by similarity, so the record to update may already exist under another Record Type. It also notes that automation can be skipped unless the trigger-workflow option is ticked, and that existing triggers or Validation Rules can reject mixed batches, which a split-by-value approach can work around. Import jobs run from a queue, so admins check Recent Import Jobs and Bulk Data Load Jobs for status and failure reasons, and users should check List Views, ownership and failed rows before re-importing.

The piece also covers fields missing from the mapping list because of page layout or field-level security, the permission needed to import Custom Objects, and the limits of imports, which cannot merge existing duplicates or change matching rules. The closing sections promote the author’s own tools, which the reader should weigh accordingly.

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

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?

Recommended

Rehearse a Salesforce Data load locally before uploading to the Org (opens in a new tab)

You will learn how to simulate a Salesforce data load against your project's triggers, flows and Validation Rules on your own machine, catching refused rows before any reach the org.

Why read this

The piece is a product walkthrough, so treat its claims about the runtime's fidelity with some caution.

  1. Map the CSV onto an object
  2. Simulate rows in a rolled-back transaction
  3. Fix refused rows and simulate again
  4. Upload to Org
How a data load is rehearsed before it reaches the org

The article argues that a Salesforce data load is effectively a deploy: each row runs through the org’s triggers, Validation Rules and flows, and problems usually surface only after the rows are in. It presents Renmy runtime, a local Apex runtime that runs the same automation on a developer’s or admin’s own computer against an embedded database, with no org, Scratch Org or sandbox needed. The piece is a vendor product walkthrough, so its claims about how closely the runtime matches Salesforce should be read with caution. The article points to a public parity record, which it says lists where the runtime matches the platform and where it does not.

The walkthrough runs in IntelliJ IDEA through the plugin Renmy Runtime - Salesforce IDE. The user opens the Salesforce DX project their developers keep in version control, which supplies the triggers, flows and Validation Rules. They then load a CSV in the plugin’s Data Loader, map its columns to object fields, and flag unreadable cells before anything runs. Pressing Simulate processes the rows in batches of 200 inside a transaction that is rolled back, and reports which changes would be made and which rows would be refused, with the platform’s own error messages. The user fixes the file and simulates again as often as needed, and only then uses Upload to Org to send the same file to a chosen org, with a confirmation that names the org and row count. The example is an invoice update in which three rows fail a Validation Rule and three dates cannot be read.

The article also describes a Workbench for editing individual records with automation switched on, and a Save as Fixture option that turns rows into test data for developers. It is explicit about the limits: the rehearsal cannot see automation that exists only in the org until it is retrieved, and for updates the referenced records must also exist locally, where Clone Org Data can copy a slice of the org down. The org remains the final authority. The article also says the rehearsal does not contact an org and keeps source, schema and data on the local machine, and that the Free tier covers the Data Loader and Simulate. It describes the Pro tier as free during the public beta, with a listed price of $19 a month afterwards. It presents the tool as suited to admins with no coding skills, though a developer’s project checkout is needed.

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

Worth reading?