The independent daily for Salesforce admins, developers and architects

Curated by Abhinav (opens in a new tab)

Running Apex tests locally with Renmy Runtime, without an org (opens in a new tab)

You will learn why Apex has no local run loop, what a local Apex runtime changes for testing, debugging and CI, and which platform rules still apply locally.

Why read this

The article is a vendor-led introduction to a third-party tool, so weigh its claims accordingly.

The article explains that Apex looks like Java but only compiles, runs and tests inside a Salesforce org, so every iteration means deploying, waiting and reading logs. It argues that this deploy-to-run loop is slow, and that CI pipelines need an org and certificate just to run unit tests. Its benchmark claims four open-source Apex suites of 837 tests took about 1 min 46 s in an org versus 2.4 s locally, with every test passing in both.

The author presents Renmy Runtime, a single binary that executes Apex, SOQL, DML and Salesforce Flows on a developer’s machine against an embedded PostgreSQL, with no org, Docker or JVM. Commands such as renmy test, renmy validate and renmy explain run tests, type-check changes and explain failures, and the tool reports line and branch coverage. A JetBrains plugin adds breakpoints in IntelliJ IDEA, a SOQL and Apex console, and mutation testing as a Pro feature. The CI example runs the suite and emits JUnit XML and Cobertura without an org.

The piece is candid that some differences remain: governor limits, order of execution and metadata-defined schemas still apply, and the runtime is not the platform itself. It recommends keeping sandboxes or Scratch Orgs for UI, integration and final validation, with renmy deploy checking the same bytes in the org before release.

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

Worth reading?

Recommended

Salesforce integrations fail on quota and data model, not protocol (opens in a new tab)

You will learn how the org-wide daily API allocation is calculated and why batching is a design decision rather than a tuning step.

Why read this

You will also see the Apex governor limit trap that breaks batch writes, and the external ID and upsert pattern that makes retries safe.

  • 5000: Contacts written one record per call
  • 25: Calls needed via sObject Collections at 200 per request
  • 100: SOQL query ceiling per synchronous transaction
Batching cuts the calls needed to write 5,000 Contacts by a factor of 200

The article argues that Salesforce integrations rarely fail on authentication or protocol. They fail on the daily API request allocation, which is shared across every consumer in an org, and on the data model choices that are costly to reverse once records exist. It walks through the main APIs, noting that REST and SOAP are both current, that Bulk API 2.0 is a different asynchronous programming model, and that Composite and sObject Collections cut call volume sharply because each counts as one call against the allocation.

The piece then covers the constraints that shape the architecture. The allocation is set by edition and license count, and requests fail with REQUEST_LIMIT_EXCEEDED once it is exhausted, with no grace on trial and Developer Edition orgs. Batching is presented as a design decision: a 5,000 record job costs 5,000 calls one at a time but 25 through sObject Collections. Caching reference data is also suggested. Governor limits are explained as applying to customer Apex that runs when an inbound write fires triggers, and an unbulkified trigger can exceed the 100 query ceiling on a 200 record batch.

Finally, the article addresses authentication, the Lead, Contact, Account and Person Account decisions, external IDs for idempotent upserts, partial-success handling, dead letter stores and reconciliation, and sandbox and API version pinning. It also discusses when middleware is justified and the UK GDPR obligations around controllers, processors and transfers. The cost ranges and vendor-agnostic claims are the author’s own estimates and are not independently verified.

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

Worth reading?

Must-read

Why a static Boolean Trigger guard silently skips records in bulk (opens in a new tab)

You will learn why a static Boolean recursion guard fails when a DML statement touches more than 200 records, how to reproduce the bug with a test, and how to replace it with an Id-based Set or a change-based check.

Static Boolean guard

  • One flag for the whole transaction
  • Chunk 2 onward is skipped
  • 800 of 1,000 records unprocessed
  • Insert still succeeds silently

Id-based Set guard

  • Tracks each record Id
  • New Ids in each chunk processed
  • Recursive Ids already in set skipped
  • Guards afterUpdate, not inserts
A static Boolean guard against an Id-based Set in a bulk trigger

Many Apex trigger tutorials recommend a static Boolean flag to stop a trigger from running again during recursion. The article argues this flag can silently skip records in production. Salesforce splits any DML statement touching more than 200 records into chunks of 200, running the trigger once per chunk within the same transaction. A static variable persists across those chunks, so the guard cannot distinguish a recursive call from the next batch of records, and records beyond the first chunk never get processed, though the insert still succeeds.

The problem is most likely in Batch Apex with a scope above 200, data migration scripts run from Anonymous Apex, service classes that insert or update large lists, and Flows that change many records in one element. It rarely appears in UI testing because records are saved one at a time. The article provides a test that inserts 201 Accounts and asserts that all 201 are processed. With the Boolean guard the test fails, reporting 200 processed, while a bulk-safe test catches the defect before release.

The recommended fix is to track record Ids in a Set rather than a single Boolean. Adding each Id to the set returns false when it was already present, so only genuinely new records are processed in later chunks, while a true recursive update is skipped. The article notes practical details: guard afterUpdate rather than inserts because records in before insert have no Ids yet, keep separate sets per event if both beforeUpdate and afterUpdate do work, and accept that a record updated twice on purpose is handled only once.

Often the better solution is to avoid needing a guard. Comparing field values against Trigger.oldMap and acting only on the change of interest stops recursion naturally, because the follow-up update does not change the field again. A before-insert handler that only sets fields on Trigger.new cannot cause recursion and needs no guard. The article closes with a checklist: search the org for static Boolean flags in trigger handlers, remove guards that are unnecessary, react to changes rather than every update, use Sets where a guard remains, and test every trigger with 201 or more records in one statement. The article also promotes a commercial starter kit, which is not part of the technical guidance.

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

Also told by dev.to (opens in a new tab), dev.to (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

Catching AI-Generated Apex that breaks governor Limits with budget tests in CI (opens in a new tab)

You will learn how to measure governor limit consumption in Apex tests, set per-context budgets, and close the loop so AI agents fix limit-heavy code before it merges.

Why read this

The post includes a snapshot class pattern, a limits table and a retry-and-escalation design.

  1. Agent pushes code with bulk tests
  2. CI measures limit consumption
  3. Breach sends feedback to agent
  4. Up to two refactor attempts
  5. Human architect review if still failing
How the CI loop handles a governor limit breach in agent-written code

The article argues that AI-generated Apex can be functionally correct and fully unit-tested yet still exhaust shared transaction budgets, because agents build each feature in isolation and small additions compound until a governor limit is breached. Standard small-data tests rarely expose this, and since governor limits are platform capacity ceilings, the author recommends treating them as architectural contracts and enforcing them automatically before code merges. It illustrates the compounding with a sprint-by-sprint example where SOQL consumption climbs from 15% to 59% through individually harmless changes.

The proposed approach has several parts. Teams should supply a shared, immutable GovernorLimitSnapshot test utility, require agents to write bulk tests of 200 records that capture before and after snapshots, and have CI verify that these test conventions are present. A table compares synchronous and asynchronous limits, and a budget-allocation table recommends consumption thresholds by execution context: roughly 40 to 50% for trigger code, 60 to 70% for service classes, 80 to 85% for isolated asynchronous jobs, and 20 to 30% for Scheduled Apex. Snapshots should be taken just before Test.stopTest() so the synchronous footprint is measured separately from asynchronous work, which is tested in its own method.

The article then describes a closed feedback loop in CI. When a test breaches its budget, a structured prompt containing the metric, consumption, threshold and required optimization steps goes back to the agent, which gets up to three attempts, with the delta between attempts supplied on later tries. If the third attempt fails, the merge is blocked and a human architect is asked to review, possibly moving the logic to Queueable. Agents must not be allowed to weaken tests or thresholds, and the author notes that some limits, such as callouts and Platform Event publishing, need production monitoring as well. Thresholds should start generous, use warning and violation tiers, and be tightened over time, with a closing checklist for rolling the pattern out.

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

Worth reading?

Ten Flow design mistakes that break Salesforce orgs as they scale (opens in a new tab)

You will learn how bulk record processing, database operations inside loops, repeated writes, hard-coded IDs and weak fault handling make Flow fail under load, and how to design around each one.

Why read this

The piece is practical guidance for anyone whose orgs run record-triggered automation at volume.

This Salesforce Ben article, written for architects, lists ten Flow design mistakes that cause failures as orgs grow, and suggests a fix for each. The first concerns treating Flow as a single-record tool: bulk operations from Data Loader or List Views share one transaction’s governor limits, so authors should use before-save flows for same-record updates, tighten entry conditions, and make invocable Apex bulk-safe. The second warns against database operations inside loops, recommending retrieving records before the loop, changing values in memory, and saving a collection once afterwards, with Collection Filters and Transform as alternatives. The third covers writing to the database too often, since each write can fire further automation and cause record-locking, so decisions should come first and writes should be batched near the end.

The next several points cover maintainability, testing and error handling. Hard-coded IDs break when flows move between environments, so the article recommends looking up records by DeveloperName, using Custom Metadata, Custom Labels or Custom Settings. Flows without deliberate fault handling leave failures to Salesforce’s default response, so authors should choose between blocking saves, guiding users, or logging failures, and should understand how rollback differs for unhandled errors, handled faults and explicit rollbacks. Testing with a single record gives little assurance, so the article urges bulk tests of at least 200 records, representative data, and separate logic, transaction-limit and load testing.

The final points address structure and design. Monolithic flows are hard to maintain, so the piece suggests subflows for repeated logic, self-contained processes and frequently changing rules, while warning against too many tiny subflows and recommending grouping flows by business purpose. Transaction boundaries matter because governor limits apply per transaction, and asynchronous paths, scheduled paths, screens, Wait elements and Platform Events can move work out of the original save, with the trade-off that committed changes cannot be rolled back. Screen Flows need care when users click Previous, which can cause duplicates, so the article advises saving at the end and making steps idempotent. Finally, it cautions that data model problems such as data skew, non-selective queries, recreated roll-up functionality and master-detail choices can limit what Flow design alone can fix. The conclusion advises reviewing the highest-volume objects first.

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

Worth reading?

Recommended

Trigger Lib: a role-based Apex trigger framework built around governor limits (opens in a new tab)

You will learn how Trigger Lib splits trigger logic into populators, validators, writers and dispatchers, how orchestrators and Custom Metadata Types register handlers, and how its add-on interfaces bulkify queries and batch DML.

Trigger Lib handler roles

  • Populator
  • Validator
  • Writer
  • Dispatcher
Trigger Lib has four handler roles, each with one job in a trigger context

The article introduces Trigger Lib, an open-source Apex trigger framework from the Apex Fluently collection, written by an author who argues that Flows are impractical and that Apex triggers are the best automation option, provided they are organized well. The author’s main complaint is that existing trigger frameworks rarely help teams manage governor limits, which become a serious risk when AI-generated code and other automations share a transaction. Trigger Lib is deliberately not metadata-driven. It can be started with an orchestrator class that lists handlers, or with runFromMetadata() for handlers registered in Custom Metadata Types, and Custom Metadata is then used only to switch handlers off.

Handlers are split into four roles: Populators set field values in before insert and update, Validators reject invalid records in before contexts, Writers queue DML on a shared Unit of Work in after contexts and before delete, and Dispatchers start Queueable jobs or publish events in after contexts. Each role has a qualifying method and an action method, and SOQL and DML are blocked in the per-record methods. Add-on interfaces such as ParentQuery, PriorParentQuery, RelatedQuery, OwnUnitOfWork, Bypassable, RecursionGuard, Finalizer and ContinueOnError extend these roles, for example to bulk-load parents and related records or to let a failing handler be logged without failing the save.

The author analyzed 919 SOQL queries from three projects and found that parent and config queries made up most of the total, which is why the framework bulk-loads parents once per chunk and recommends static variables for configuration data. Writers commit through DML Lib, which orders inserts by dependency and performs one DML per operation and object type at the end of the run. The article is cut off during its discussion of the Logger interface, so the logging details are not covered.

Read the original at Beyond the Cloud (opens in a new tab)

Worth reading?

Five timing decisions that determine whether a Scheduled Flow runs reliably (opens in a new tab)

You will know five design choices to settle before activating a Scheduled Flow: run window, repeat-safety, batch sizing, failure handling and run context.

Why read this

The article is a practical checklist rather than new platform information.

  1. Pick a quiet run window
  2. Make repeat runs safe
  3. Size batches for volume
  4. Catch failures loudly
  5. Confirm the run context
The five timing decisions to settle before activating a Scheduled Flow, in order

The author argues that a Scheduled Flow should be designed around timing, since nobody watches it run. The run window should avoid overnight integrations, data loads and backups that might lock the same records, so admins should check scheduled Apex jobs and ask integration owners before choosing a start time.

Because a daily Scheduled Flow re-evaluates its entry criteria on every run, records that still qualify will be processed again. The article recommends a flag field, a date stamp or a processed checkbox so that updates happening once are not repeated, and it treats batch sizing as a deliberate design decision, warning that a Flow tested on fifty records can hit governor limits at fifty thousand.

The piece also covers failure handling, which is quieter than for Record-Triggered Flows, and run context, since Scheduled Flows run in system context by default and bypass Sharing Rules and field-level security. It closes by suggesting a monthly review of every active Scheduled Flow as business rules and fields change.

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

Worth reading?

Must-read

How a local Apex runtime speeds up testing without replacing your org (opens in a new tab)

You will learn how a local runtime executes Apex and Flow metadata against an embedded database while enforcing governor limits and order of execution.

Why read this

The article explains how this approach accelerates the edit-test cycle and fits into your standard deployment workflow.

Local Apex runtime

  • Apex interpreter
  • Local database for SOQL and DML
  • Rule engine for limits and execution
The local Apex runtime is built from three core components

The article, written by the maker of renmy runtime (formerly Nimbus, renamed in October 2026), introduces a local Apex runtime: a program that executes Apex, SOQL and DML on a developer’s own machine without a Salesforce org. It argues that Salesforce developers work in a slow loop, where every edit is deployed to an org and tested there, while developers in Java, JavaScript and Go run tests locally in about a second. The author attributes this gap to Apex being multi-tenant and tied to the platform’s data model and order of execution. Cited costs include round trips to the org, CI that needs org credentials, outages that halt testing, and AI coding agents that cannot iterate quickly. A local runtime has three parts: an Apex interpreter, an embedded PostgreSQL database for real queries and DML, and the platform’s rules, including enforced governor limits, triggers and Flows in order of execution, and per-test rollback. A sample test runs in tens of milliseconds, and the article says the runtime is not a mock, not a Scratch Org and not a transpiler.

The article is clear that a local runtime does not replace the org. Lightning pages, user-facing Screen Flows, permission checks, real integrations and the deploy itself with Salesforce’s metadata validation still happen in the org. The author compares this to a Java team’s staging environment, which stays for integration and final checks but is not the only place code runs. The renmy deploy is described as running local test and coverage gates first, then a check-only validation in the target org, then the deploy. The tool also offers coverage reporting, mutation testing, a debugger in VS Code and JetBrains, an MCP server for AI coding tools, and an IDE plugin. A published benchmark reports that 837 tests from four open-source suites ran in about 2.4 seconds locally versus about 1 minute 46 seconds in an org, with all tests passing in both.

Installation is a single binary for macOS, Linux and Windows, with no JVM, Docker or org required, and the commands are renmy test “” from the project root, plus options for single classes, coverage and a browser dev UI. The free tier covers individual developers, while Pro and Team tiers are free during the public beta and listed at $19 per month and $49 per developer per month. The article links to a parity record, which it describes as not a claim of 100 percent accuracy, and to GitHub for issues and releases.

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

Worth reading?

How elastic limits extend Async Apex capacity and throttle processing in Winter '27 (opens in a new tab)

You will learn how the Winter '27 extension of elastic limits increases Async Apex capacity while throttling throughput, and how to monitor usage with the OrgLimits class.

The Winter ’27 release extends the beta capability of elastic limits to Batch jobs, following its initial introduction for Queueable and Future methods in Summer ’26. When standard asynchronous governor limits are reached, the system allows additional enqueues up to a secondary cap calculated as the minimum of two million or the standard limit. Enqueued jobs beyond the baseline trigger throttling, which slows active processing and restricts Batch jobs to a single concurrent instance.

Developers can track consumption using the OrgLimits class, specifically querying the DailyAsyncApexElasticExecutions metric alongside the standard daily limit. The feature remains exclusive to production environments, meaning sandbox and trial orgs do not receive the extra capacity. Salesforce intentionally omits exact throttling metrics to prevent teams from treating the slowdown behavior as a guaranteed service level.

Scheduled Apex does not support elastic limits because the feature trades execution speed for additional volume, which conflicts with the time-sensitive nature of scheduled runs. The author advises using the extra capacity strictly as a resilience buffer rather than a primary scaling strategy, recommending that organizations investigate root causes when they regularly approach baseline limits.

Read the original at Bob Buzzard Blog (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?

New Collection Filter Criteria Resource simplifies Flow Builder data manipulation (opens in a new tab)

You will learn how the new Collection Filter Criteria Resource moves collection filtering out of the Flow canvas and into reusable resources.

Why read this

The piece explains how this change reduces visual clutter, optimizes governor limits, and enables in-memory sorting and filtering.

Collection Filter Criteria

  • Configured via Manager tab
  • Returns only first match
  • Eliminates extra Loop steps
  • Supports child relationships

Collection Filter and Sort

  • Placed directly on canvas
  • Returns full record collection
  • Requires additional Loop steps
  • Standard element configuration
Comparison of the new Collection Filter Criteria resource against existing Flow elements

Introduces the Collection Filter Criteria Resource as a Winter ’27 preview feature that shifts collection filtering from canvas elements to the resource manager. It replaces the traditional Collection Filter node, allowing administrators to define dynamic filter conditions and sort orders directly in memory without triggering additional SOQL queries or DML operations.

Explains the practical benefits, including cleaner Flow Builder canvases and optimized transaction limits. Multiple distinct filter views can now point to a single source collection, eliminating sequential logic and reducing visual complexity while speeding up execution across screen and autolaunched flows.

Covers advanced integration with Apex defined variables, noting that future updates will allow filtering based on child relationships within custom data structures. This capability aims to remove unnecessary loops during collection processing and hints at upcoming list and map functionality resembling native Apex collections.

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

Also told by Salesforce Admins Blog (opens in a new tab), Salesforce Time (opens in a new tab)

Worth reading?

How to write effective Apex tests that pass deployment gates and avoid common pitfalls (opens in a new tab)

You will learn the exact platform requirements for Apex test coverage and how to structure tests that actually validate business logic instead of just inflating percentages.

Why read this

The piece also outlines practical patterns for bulk-safe test data and deployment troubleshooting.

The article explains that Salesforce enforces mandatory Apex test runs to protect multi-tenant reliability and prevent regression. Production deployments require at least seventy-five percent org-wide code coverage, complete trigger coverage, and zero failing methods, though test classes themselves are excluded from the calculation.

It emphasizes that coverage metrics alone do not guarantee quality, urging developers to replace empty test methods with explicit System.assert calls that verify business outcomes rather than implementation details. Writers are advised to cover both happy and unhappy paths, including validation failures and governor limit boundaries.

Practical guidance follows for building robust test suites, recommending the use of @TestSetup for shared fixtures, centralized test data factories, and inserting two hundred records to simulate bulk trigger behavior. The piece also clarifies how Test.startTest and Test.stopTest reset governor limits and synchronize asynchronous executions.

Finally, it lists common deployment hurdles such as coverage resetting after metadata edits, mixed DML errors when creating users alongside other objects, and the recommendation to target ninety percent coverage for safety margins. Individual class debugging is suggested to isolate failures quickly.

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

Worth reading?