The independent daily for Salesforce admins, developers and architects

Curated by Abhinav (opens in a new tab)

Recommended

Working around the 2,000-row cap on report exports after step-up authentication (opens in a new tab)

You will learn why scheduled report exports now fail or stop at 2,000 rows after the Summer '26 changes, and the four practical options for fixing refreshes: manual export, narrower reports, a suitable connector, or SOQL.

  1. Export manually for a one-off pull
  2. Narrow the report with filters
  3. Use a connector built for the change
  4. Move recurring extracts to SOQL
Four ways to adapt a report export that stops at 2,000 rows

From July 1, 2026, Salesforce requires step-up authentication for exporting and printing reports, even for users already signed in with MFA. Viewing or running a report does not trigger the check. Admins can configure the policy under Session Security Level Policies with a step-up period from 1 to 120 minutes. Scheduled jobs cannot complete the check, so spreadsheet and BI tools have moved to the Analytics API, which uses OAuth and does not trigger it.

The Analytics API returns at most 2,000 rows per report run, and no permission or setting raises that cap. Other limits apply too: 500 synchronous report runs per hour, 1,200 asynchronous requests per hour, 20 Custom Field filters per run, and 100 columns per report. These limits are shared across the org, so heavy scheduled refreshes can affect other processes.

The article offers four options. For a one-off need, use a Details Only export by hand. To stay under the cap, narrow the report with filters such as My or My Team’s, fewer columns or a shorter date range, and apply tighter filters in your own pull rather than editing a shared report. For recurring pulls over 2,000 rows, choose a connector that uses the Analytics API and retrieves the full report. For large, regular extracts, use SOQL, which avoids the export and API report limits, though groupings, subtotals and formulas must be rebuilt and queries should be reviewed against the report’s logic.

The article closes by advising a review of scheduled refreshes before they compete for the shared API limits. It also promotes Xappex connectors, which handle these cases, and this promotion is the source’s own commercial interest.

Read the original at Salesforce Ben (opens in a new tab)

Worth reading?

Must-read

Bulkifying an Opportunity trigger to avoid the 101 SOQL limit error (opens in a new tab)

You will learn why a per-record SOQL query inside a trigger loop fails on bulk loads, and how to refactor it to one query and one DML statement using a map keyed by Account ID.

Why read this

You will also see the trade-offs between triggers, Flows and Queueable Apex.

Per-record (fails)

  • Query Account inside the loop
  • Update Account inside the loop
  • Fails on record 101

Bulk-safe (map)

  • Collect deltas in a map by AccountId
  • One SOQL query with IN
  • One DML update for the list
The failing per-record pattern set against the bulk-safe pattern

A trigger that passes a single-record test can fail a 200-row bulk import with a Too many SOQL queries error. This happens with Data Loader, Bulk API and scheduled integrations, and it usually shows up first in production, because sandbox test data rarely reaches 200 rows per batch. The article argues that the fix is to change how the trigger reads and writes data, not to retry or buy more licences.

The author uses an after update trigger on Opportunity that adds the Amount of newly closed-won deals to a Total_Won__c field on the parent Account. The original version queries and updates the Account once per record, which breaks on record 101 under the 100 SOQL limit and would also run into the 150 DML statement cap. The article uses this failing version to show the cause of the error.

The refactor has three steps. First, audit every query and DML statement that sits inside a loop over Trigger.new. Second, collect the qualifying deals into a map keyed by AccountId, filtering on the stage change so later edits do not double count, then run a single query with IN and a single update. The map also merges several deals for the same Account. Third, weigh the options: a handler class gives testability and bulk control, Record-Triggered Flow is quicker for simple logic but shares the same caps, and Queueable Apex allows more queries and CPU time at the cost of eventual consistency.

The article closes with a short FAQ. It notes that a LimitException cannot be caught with try-catch, that Limits.getQueries() can be used to check usage, and that Queueable suits follow-up work while Batch Apex suits large record sets. It recommends testing with 200 records in a single call so that the test matches the real chunk size.

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

Worth reading?

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?

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?

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?

A VS Code extension runs anonymous Apex and SOQL with a single keyboard shortcut (opens in a new tab)

Readers will learn how to install and configure Virga to execute throwaway Apex and SOQL scripts without leaving the editor.

Why read this

The piece also explains how the extension resolves common language server completion issues and disables telemetry during local runs.

Virga is a free VS Code extension designed to streamline the execution of throwaway Apex and SOQL scripts directly within the editor. Setup requires VS Code version 1.90 or newer, the Salesforce CLI on the system path, and an active Salesforce DX project. Users create dedicated scratch tabs for either language, trigger execution with a keyboard shortcut, and receive formatted output showing compilation status, debug logs, governor limits, or flattened query results.

The tool handles execution through a temporary file copy rather than direct command line arguments, which prevents partial edits from affecting the run. It achieves a seamless experience by applying a brief auto-save delay that clears tab dirtiness markers, allowing instant closure without save prompts. Scratch files persist in a version control ignored folder and survive editor restarts, while conflicting keymaps are handled to preserve the shortcut exclusively for scratch contexts.

Beyond basic execution, the extension patches gaps in the standard Salesforce Extension Pack. It adds completion support for inner types declared in the same file, identifies and offers quick fixes for parameter shapes that crash the language server, and supplies missing snippets for annotations and user mode operations. Privacy is maintained by automatically disabling Salesforce CLI telemetry for each run, though administrators can enforce global telemetry suppression through standard configuration commands.

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

Worth reading?

Seven Apex best practices for handling governor limits and bulk processing (opens in a new tab)

Readers will learn how to structure Apex transactions to avoid governor limit exceptions by applying bulkification patterns, optimizing data operations, and designing realistic test suites.

The article explains that Salesforce multitenancy requires strict resource management through governor limits that cap SOQL queries, DML statements, CPU time, and heap size. Developers are advised to treat these boundaries as foundational design constraints rather than post-development hurdles.

Core recommendations focus on eliminating database operations from iterative loops. The piece demonstrates collecting target identifiers into sets, executing single bulk queries, and populating maps for rapid lookups. It also shows how to accumulate records into lists for batch insertions while checking for empty collections beforehand.

Efficient use of Apex collections and comprehensive testing strategies receive equal emphasis. Writers are instructed to select appropriate collection types based on lookup needs and to validate logic against high record volumes. Testing must account for downstream automation overhead and varying data relationships to prevent unexpected limit exhaustion.

Finally, the guide outlines ongoing maintenance practices, including reviewing debug logs and refactoring inefficient code as data scales. It notes that persistent limit failures often stem from interconnected automation layers, requiring architects to evaluate broader system design alongside individual class performance.

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

Worth reading?