You are here:
Manage Version Settings for Apex
To aid backwards-compatibility, Apex classes and triggers are stored with version settings for the Salesforce API and any referenced managed packages.
Required Editions
| Available in: Salesforce Classic (not available in all orgs) and Lightning Experience |
Available in: Performance, Unlimited, Developer, Enterprise, and Database.com Editions Managed Packages are not available in Database.com. |
| User Permissions Needed | |
|---|---|
| To define, edit, delete, set security, and set version settings for Apex classes: | Author Apex |
| To run Apex tests: | View Setup and Configuration |
If the Apex class references components, such as a custom object, in installed managed packages, the version settings for each managed package referenced by the class is saved too. This ensures that as Apex, the API, and the components in managed packages evolve in subsequent released versions, a class or trigger is still bound to versions with specific, known behavior.
A package version is a number that identifies the set of components uploaded in a package. The version number has the format majorNumber.minorNumber.patchNumber (for example, 2.1.3). The major and minor numbers increase to a chosen value during every major release. The patchNumber is generated and updated only for a patch release. Publishers can use package versions to evolve the components in their managed packages gracefully by releasing subsequent package versions without breaking existing customer integrations using the package.
- Edit either a class or trigger, and click Version Settings.
- Select the Version of the Salesforce API. This is also the version of Apex associated with the class or trigger.
- Click Save.
Configure the Package Version Settings for a Class or Trigger
- If you save an Apex class or trigger that references a managed package without specifying a version of the managed package, the Apex class or trigger is associated with the latest installed version of the managed package by default.
- You cannot Remove a class or trigger's version setting for a managed package if the package is referenced in the class or trigger. Use Show Dependencies to find where a managed package is referenced by a class or a trigger.
- Edit either a class or trigger, and click Version Settings
- Select a Version for each managed package referenced by the class or trigger. This version of the managed package will continue to be used by the class or trigger if later versions of the managed package are installed, unless you manually update the version setting. To add an installed managed package to the settings list, select a package from the list of available packages. The list is only displayed if you have an installed managed package that is not already associated with the class or trigger.
- Click Save.

