Salesforce Summer ’26 Is Changing How SOQL Works – Here’s What You Need to Know

Every Salesforce release brings platform improvements. Summer ’26, however, delivers something more significant for developers: a fundamental shift in how SOQL queries behave by default. These are not cosmetic updates. They alter security models, introduce powerful new query capabilities, and deprecate old patterns that many orgs still rely on. If you write Apex or work with SOQL regularly, understanding these changes is not optional.

Why This Release Matters for SOQL

Summer ’26 introduces API version 67.0. With it comes the most consequential change to the Apex security model in years. The default execution context for database operations has flipped from system mode to user mode. That single change has cascading implications across every Apex class and SOQL query in your org.

Alongside that, Salesforce is piloting a new FORMULA() function directly inside SOQL WHERE clauses. It also removes the WITH SECURITY_ENFORCED clause entirely. Together, these three changes reshape how developers query data on the platform.

The Big Shift: User Mode Is Now the Default

What Changed

Prior to API version 67.0, Apex database operations ran in system mode. That meant queries bypassed the running user’s field-level security (FLS), object permissions, and sharing rules. The platform assumed elevated access by default.

From v67.0 onward, that assumption is gone. Apex database operations now run in user mode by default. In user mode, database operations enforce the sharing rules, field-level security, and object permissions of the current user.

What This Means in Practice

Consider a simple query like this:

apex
SELECT Id, Name, Salary__c FROM Employee__c

In API v66 and earlier, this query returns Salary__c for all users, regardless of whether they have FLS access to that field. In API v67, if the running user does not have access to Salary__c, the field is stripped from the result set or throws a QueryException.

WITH USER_MODE isn’t just a rename. It handles polymorphic fields, checks the WHERE clause and not just the SELECT list, and reports every FLS violation instead of only the first.

The Sharing Default Also Changed

A class compiled at API v67.0 with no sharing declaration now defaults to with sharing instead of without sharing, so bypassing sharing is now a deliberate without sharing declaration.

This is a significant behavioral change. Any class without an explicit sharing keyword will now enforce the running user’s record visibility. Code that previously returned all records may now return a filtered subset.

Triggers Behave Differently Too

Apex triggers always run in system mode. This means they bypass the sharing rules, field-level security, and object permissions of the current user. This provides consistency and eliminates edge cases where trigger behavior varied by context.

WITH SECURITY ENFORCED Is Gone

The Removal

The WITH SECURITY_ENFORCED SOQL clause is removed in API version 67.0. Apex classes set to API version 67.0 and later that include WITH SECURITY_ENFORCED do not compile.

This is a compiler-level breaking change. It is not a deprecation warning. Code using this clause will fail to compile.

What to Use Instead

Replace every instance of WITH SECURITY_ENFORCED with WITH USER_MODE. The new clause is more capable and more explicit. It enforces FLS, object permissions, and sharing rules in a consistent and predictable way.

apex:
// Before (v66 and earlier)
SELECT Id, Name FROM Contact WITH SECURITY_ENFORCED

// After (v67 and later)
SELECT Id, Name FROM Contact WITH USER_MODE

The recommendation from Salesforce is clear: for new code, explicitly declare access mode using WITH USER_MODE to make intent clear and avoid relying on implicit defaults. Any query that requires system-mode execution must include WITH SYSTEM_MODE.

New Capability: FORMULA() in SOQL WHERE Clauses

The Problem It Solves

Filtering records based on a calculated value has always required workarounds. Developers typically added formula fields to the data model, wrote post-query Apex loops, or retrieved far more records than needed.

With the Summer ’26 release, Salesforce is piloting FORMULA() in SOQL WHERE clauses, enabling you to filter rows using compiled formula expressions instead of adding one-off formula fields or post-processing in Apex. This helps developers reduce schema clutter, simplify queries, and write less “query everything, filter later” code.

How It Works

The syntax is straightforward. Instead of querying all opportunities and filtering in a loop, you can push the condition into the query itself:

apex:
// Before: query then filter in Apex
List<Opportunity> opps = [SELECT Id, Amount, Probability FROM Opportunity];
for (Opportunity opp : opps) {
    Decimal expected = opp.Amount * opp.Probability / 100;
    if (expected > 10000) { /* logic */ }
}

// After: filter directly in SOQL
List<Opportunity> opps = [
    SELECT Id, Name FROM Opportunity
    WHERE FORMULA(Amount * Probability / 100) > 10000
];

The new FORMULA() support in SOQL WHERE clauses can simplify many real-world Salesforce development scenarios. Instead of writing additional Apex logic or creating multiple formula fields, developers can handle simple calculations directly inside queries.

Current Status and Constraints

This feature is currently in pilot. The pilot is open to any Salesforce customer. Contact your Salesforce Account Executive or Customer Success Manager to request access. It is not yet generally available, so syntax and supported operators may change before GA.

For ISVs in particular, this feature addresses a real pain point. This is especially valuable when you cannot or do not want to change the data model for every subscriber org, a common scenario for ISVs or developers who want to keep operational segmentation logic visible in SOQL instead of buried in loops.

Additional SOQL Changes Worth Noting

New SET OPTIONS Clause for Data 360

A new SET OPTIONS clause in SOQL lets developers specify Data 360 dataspaces and control how NULL and empty string values are handled when querying Data 360 data lake objects. Dataspace is required for Data Lake Object queries. Omitting it returns zero records.

Named Query API Now Generally Available

The Named Query API allows developers to define and expose custom SOQL queries as scalable actions for REST API clients and AI agents, with better retrieval performance than equivalent Flow or Apex-based processes. This is particularly relevant for orgs adopting Agentforce, where queries need to be exposed as accessible tools for AI agents.

Best Practices for the Transition

Audit Your Existing Code Now

Do not wait for production to surface issues. Identify every class using WITH SECURITY_ENFORCED and replace it with WITH USER_MODE. Then review all classes without an explicit sharing declaration.

Identify Apex classes in active development or recently deployed that lack an explicit sharing declaration, along with any SOQL queries still using WITH SECURITY_ENFORCED. Flag them before the next API version increment.

Test in Sandbox Against API v67.0

Behavioral changes tied to API versions are subtle. A query that returned ten records in v66 may return three in v67 for the same user. Test your critical flows against v67.0 in a sandbox before any production upgrade.

Be Explicit About Access Mode

Going forward, always declare your intent. Relying on defaults creates ambiguity and makes code harder to reason about during review. Use WITH USER_MODE or WITH SYSTEM_MODE explicitly in every query where access mode matters.

For Triggers, Verify Your Logic Still Holds

Since triggers now consistently run in system mode, any code path inside a trigger that previously relied on sharing enforcement will no longer behave that way. Review trigger logic that checks record visibility assumptions.

Key Takeaways

Summer ’26 raises the security baseline for Apex and SOQL across the board. The shift to user mode by default closes a long-standing gap where developers had to opt in to security rather than opt out. The removal of WITH SECURITY_ENFORCED enforces a cleaner, more intentional pattern. Meanwhile, FORMULA() in WHERE clauses opens a more expressive way to query data without bloating your data model.

The most important action right now is to audit your codebase against these changes before upgrading to API v67.0. Developers who treat this release as a compliance requirement will find it disruptive. Those who treat it as a long-overdue security improvement will be better positioned for everything Summer ’26 brings.

Read More!

Summer ’26 Release Architect Highlights: Sharing, Security, and Agentic Integration

Share this article...

As Managing Partner and CTO at codeSTREETS, I help global businesses scale through robust Salesforce architecture and custom software solutions. With 10+ years of experience in enterprise transformation, I lead teams to deliver results-driven, future-ready digital platforms. My expertise spans cloud architecture, product innovation, and mentorship, earning recognition as a speaker and community leader. Let’s connect if you’re seeking tailored solutions, seamless implementation, or strategic partnerships to accelerate your business growth.

Leave a Reply

Your email address will not be published. Required fields are marked *