You are here:
Apex
Database operations now run in user mode by default, not system mode. Further,
database operations enforce the current user’s object-, field-, and record-level security
settings by default. SOQL queries no longer support the WITH SECURITY_ENFORCED
clause. Write integration Apex tests that can make callouts to Agentforce and Data 360. Enqueue
Queueable and future method jobs up to a new elastic limit. Prepare for the Block Apex Anonymous
Code Execution from Managed Packages release update. Declare multiline strings and use an
improved string interpolation method.
For more information on these enhancements, see the Apex Developer Guide and the Apex Reference Guide.
- Database Operations Run in User Mode by Default, Not System Mode
Take advantage of an enhanced Apex security model that protects your data though default object- and field-level access enforcement. Apex database operations, such as SOSL and SOQL queries, DML statements, and Database methods, 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. In earlier API versions, database operations default to system mode, which means that the current user can access all data regardless of their permissions. - Apex Classes Enforce Sharing Rules by Default
Take advantage of an enhanced Apex security model that protects your data through default record access enforcement. Apex classes without an explicit sharing declaration now default towith sharingmode, which enforces org-wide sharing settings and custom sharing rules. In earlier API versions, Apex classes without an explicit sharing declaration default towithout sharingmode, with some exceptions. Thewithout sharingmode bypasses sharing rules and allows the current user to access all records. - The WITH SECURITY_ENFORCED SOQL Clause is Removed
To run a SOQL or SOSL query in user mode, use theWITH USER_MODEclause instead of theWITH SECURITY_ENFORCEDclause. Apex classes set to API version 67.0 and later that includeWITH SECURITY_ENFORCEDdon’t compile. - Apex Triggers Always Run in System Mode
Apex triggers now always run in system mode, which means that they bypass the sharing rules, field-level security, and object permissions of the current user. Previously, nested triggers enforced sharing rules in certain edge cases. You can’t declare Apex triggers with explicit sharing or access modes. Instead, to enforce data access settings, delegate business logic to separate trigger handlers, where you can define sharing and access modes. - Write Integration Tests for Agentforce and Data 360 in Apex (Developer Preview)
Write end-to-end Apex tests that make callouts to Agentforce and Data 360. Integration tests relax callout restrictions and transaction rollback semantics, so you can validate real service interactions and assert on actual side effects in your scratch org, without mock callouts. - Avoid Workflow Disruptions by Enabling Elastic Limits for Asynchronous Jobs (Beta)
Prevent abrupt execution failures and limit exceptions if your org exceeds its daily asynchronous job limit. You can now enqueue Queueable and future method jobs up to a new elastic limit, which is twice the size of your org’s licensed daily limit. Asynchronous jobs that surpass the licensed daily limit are processed at a throttled rate. - Block Apex Anonymous Code Execution from Managed Packages (Release Update)
To strengthen subscriber org security, block managed package session IDs from authenticating anonymous Apex code. If you enable this update, installed managed packages can no longer useUserInfo.getSessionId()to obtain a session ID and then use the session ID to execute anonymous Apex. - Write Cleaner Code by Using Multiline Strings
Declare Apex strings that span multiple lines without using repeated string concatenation. To interpolate values into regular and multiline strings, use the newString.template()instance method instead of the existingString.format()static method. These features make your Apex code easier to write, read, and maintain, especially when you construct HTTP payloads and other large text blocks. - Work with Apex Code in Web Console (Beta)
Build, debug, and deploy Apex in Web Console, a client-side IDE embedded directly in Salesforce. Web Console offers a modern developer experience where you can build SOQL queries, configure trace flags and debug log levels, and execute anonymous Apex. Web Console also opens automatically when you access Apex items via the Apex Classes, Apex Triggers, or Apex Jobs pages in Setup, so you can implement modifications without disrupting your workflow. - Get Key Apex Metrics in Setup with Agentforce (Beta)
The updated Org Health and Usage dashboard now provides Apex metrics in Agent for Setup. The dashboard shows Apex classes on outdated API versions, Apex compilation errors, and current asynchronous Apex job usage. - Use Visualforce PDF Rendering Service with Apex Blob.toPdf() (Release Update)
With this update enabled, the ApexBlob.toPdf()method for PDF rendering uses the same rendering service as Visualforce. The Visualforce PDF rendering service offers improvements such as additional fonts and multibyte character support. This change makes PDF rendering more consistent on the Salesforce Platform. - Customize Apex Action Configuration in Flow Builder
InvocableActionExtension metadata enhancements give you more tools to improve users' configuration experience and reduce input errors in Flow Builder. You can now define picklist values, assign metadata types, and add custom property editors for specified input parameters. You can also add custom headers to the standard property editor. - Provide Visible No-Argument Constructors for Custom Apex Classes Used as Invocable Action Parameters
Apex classes used for invocable action parameters must have a visible no-argument constructor. The constructor must be public for non-packaged classes or global for packaged classes invoked from outside the package. Use API version 65.0 or earlier with the release update disabled to maintain the previous behavior.

