Apex

Get better performance with higher Apex heap limits. Apply elastic limits (beta) to Batch jobs and test elastic limits in nonproduction orgs. Write Apex integration tests that can share test data and call real HTTP endpoints. Filter Test Discovery API results by test level. Prevent namespace shadowing conflicts in dynamic managed Apex SOQL queries. Prepare for the Block Apex Anonymous Code Execution from Managed Packages release update. Build richer development tools with the Apex Symbol API (beta). Recompile only invalid Apex classes and triggers. Get compiler warnings for Apex saved at API versions 9.0 through 19.0.

  • Handle Larger Datasets with Increased Apex Heap Limits
    Handle larger datasets and perform more complex operations without hitting heap constraints. Increased Apex heap limits reduce the chance of encountering runtime limit errors that interrupt business processes. The Apex heap limit for synchronous transactions increases from 6 MB to 10 MB, and the limit for asynchronous transactions increases from 12 MB to 25 MB.
  • Custom Sharing Reason Available on Standard Objects
    Grant record access on standard objects by referencing a custom sharing reason (row cause) in Apex, the same way you do for custom objects. Previously, programmatic shares on standard objects were limited to the Manual row cause. A share that uses a custom sharing reason isn't deleted when the record owner changes, and a descriptive reason appears on the record's sharing page.
  • Avoid Workflow Disruptions by Enabling Elastic Limits for Batch Jobs (Beta)
    The elastic limits beta feature is now available to Batch jobs in addition to future methods and Queueable jobs. Elastic limits helps prevent execution failures and limit exceptions when your org exceeds its standard rolling 24-hour asynchronous job limit. With this feature, you can continue to enqueue asynchronous jobs up to a higher elastic asynchronous job limit. If asynchronous jobs surpass the standard limit, the system throttles the processing rate of in-flight Batch jobs and limits new Batch jobs to 1 active job at a time.
  • Test Elastic Limits by Overriding the Asynchronous Apex Job Limit in Nonproduction Orgs
    To test the behavior of asynchronous Apex jobs during elastic processing, override the standard 24-hour rolling asynchronous Apex job limit in a nonproduction org. A lower override value triggers elastic processing sooner, so you can see how asynchronous jobs behave before you turn on elastic limits in production.
  • Test External Services and HTTP Callouts in Apex Integration Tests (Developer Preview)
    Write Apex integration tests that call real HTTP endpoints, including external service endpoints, without requiring mock callouts. 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. With the new @BeforeClass annotation, you can now set up test data shared across methods within an integration test class.
  • Filter Test Discovery API Results with the testLevel Parameter
    Use the testLevel query parameter in the Test Discovery API to filter which test methods are returned based on their test level. The testLevel parameter replaces the showAllMethods parameter in API version 68.0 and later. The deprecated showAllMethods parameter is available only in API version 67.0 and earlier.
  • Resolve Field Name Conflicts in Managed Package SOQL Queries
    Prevent duplicate field name errors in managed Apex SOQL queries when your package fields and a subscriber’s custom fields share the same name. Set the explicitNamespace property on a Database.QueryOptions object and pass it as a bind variable in the SOQL SET OPTIONS clause. Without requiring an explicit namespace, Apex interprets both fields as belonging to your package namespace, failing the unique field name requirement enforced in API version 34.0 and later.
  • 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 use UserInfo.getSessionId() to obtain a session ID and then use the session ID to execute anonymous Apex.
  • Build and Use Richer Development Tools with the Apex Symbol API (Beta)
    Access comprehensive Apex type information with the Apex Symbol API (beta). This Tooling API REST resource returns detailed metadata for built-in, custom, and dynamic Apex types, such as classes, interfaces, methods, and triggers. Use this API to power code completion in IDEs, provide context for AI agents generating Apex code, or ground setup agents answering admin questions about code.
  • Reduce Overhead by Recompiling Only Invalid Apex Classes and Triggers
    Return compilation results for Apex classes and triggers with validation errors, instead of recompiling the entire org. Access the compilation results through Setup or the Tooling API endpoint. Salesforce automatically identifies only classes and triggers that require recompilation, reducing compilation overhead and minimizing potential runtime errors. Routinely perform this targeted recompilation to prevent runtime delays during peak traffic.
  • Get Compiler Warnings for Apex API Versions 9.0 Through 19.0
    Apex classes and triggers saved at API versions 9.0 through 19.0 will be retired in a future release. The Apex compiler now warns you when you compile or deploy Apex code at these API versions. To prepare for this future retirement, identify and update your Apex classes and triggers to API version 20.0 or later.
  • Process Data 360 Data Model Objects with Apex Cursors (Beta)
    Use Apex cursors with Data 360 data model objects (DMOs) to process large SOQL query result sets in manageable chunks. Create a cursor with Database.getCursor(), retrieve records with Cursor.fetch(), and get the result set size with Cursor.getNumRecords(). Monitor Data 360 cursor rows, cursor instances, and Data 360 Flex Credit limits as you process DMO records.