Recompile only invalid classes and triggers
The Tooling API endpoint /tooling/apexCompileResults targets Apex classes and triggers with validation errors instead of recompiling the whole org. Salesforce returns compilation results for that targeted set.
Use API 68.0 or later and send a POST with an empty body:
http POST /tooling/apexCompileResults
For manual use, Setup provides **Compile only invalid classes/triggers** buttons.
Successful targeted recompilation does not set the affected metadata’s isValid field to true. An isValid-only success check can therefore report failure after compilation succeeds. Before adopting targeted recompilation, review pipeline checks that rely solely on that field.
Filter test discovery with testLevel
GET /tooling/tests gains a testLevel parameter in API 68.0. Its accepted values align with the Test Runner API request body:
- RunAllTestsInOrg: the default.
- RunLocalTests: includes tests in the org namespace and flow tests, but excludes installed managed packages.
Parameter handling depends on the request’s API version:
- In API 68.0 and later, testLevel replaces the deprecated showAllMethods parameter.
- In API 67.0 and earlier, showAllMethods still works.
For local discovery in API 68.0 or later:
http GET /tooling/tests?testLevel=RunLocalTests
Before choosing RunLocalTests, confirm that excluding installed managed-package tests matches the intended discovery scope, particularly if the returned list selects tests for execution.
Address warnings for Apex versions 9.0 through 19.0
The Apex compiler now warns about classes and triggers saved at API versions 9.0 through 19.0 when compiled or deployed through Setup, Salesforce CLI, VS Code extensions, Web Console, or Tooling API. Retirement is planned for a future release; no retirement date is supplied.
For affected classes and triggers:
- Inventory ApexClass and ApexTrigger metadata saved at API versions 9.0 through 19.0.
- Update owned classes and triggers to API version 20.0 or later.
- Route managed-package findings to the package developer, who must make those fixes.
Changing a Tooling API request to 68.0 and updating a class or trigger’s saved API version are separate tasks.
This retirement is separate from Salesforce Platform API retirement and does not affect Visualforce, Flow, or Process Builder versions.
