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.

Where: This change applies to Apex API versions 9.0 through 19.0 in Lightning Experience and Salesforce Classic in Enterprise, Performance, Unlimited, and Developer editions. The compiler warnings appear in development tools that surface compiler output, including Setup, the Salesforce CLI, Salesforce Extensions for VS Code, Web Console, and Tooling API.

Important
Important The scheduled Apex API version retirement applies to Apex class and trigger metadata versions. It doesn’t apply to Visualforce page versions, Flow versions, or Process Builder versions. It also doesn’t apply to custom Apex REST or SOAP web service endpoint versions. The Apex API version retirement is unrelated to the Salesforce Platform API retirement.

How: If you deploy Apex classes and triggers with API versions 9.0 through 19.0, the Apex compiler returns this warning: Apex API version {XX} is scheduled for retirement. Update to the latest API version to avoid compile failures. If you compile Apex via the Apex Classes or Apex Triggers pages in Setup, compiler warnings identify classes or triggers that are saved at API versions 9.0 through 19.0.

To address these warnings, update the identified classes or triggers to Apex API version 20.0 or later. Salesforce strongly recommends that you use the latest available Apex API version. After updating the Apex API version, test your code thoroughly. Review previous Release Notes for each major version to understand potential changes. For a summary of major behavior changes per Apex API version, review Apex Versioned Behavior Changes in the Apex Developer Guide. Then deploy the updated classes using your standard deployment process.

Note
Note If your org contains managed Apex at API versions 9.0 through 19.0, the warning appears for those classes or triggers during compilation. However, subscribers can’t modify managed package source code. Package developers must release updated package versions with Apex classes at API version 20.0 or later. If you depend on a managed package with deprecated API versions, contact the package developer.