1

Is there any way to check the apex class ApiVersion Before deploying it?

For example, let's say a developer is trying to save an apex class with API Version 25, We need to show an error message 'The API version must be above 40'

2
  • 1
    I don't think there is a dedicated method in, let's say, sfdx. You would need to incorporate some custom scripting before the deployment, like XML parsing of the .cls-meta.xml files from the repository. But this would require educating users to do the deployment only via this script and never manually or blocking manual deployments entirely and performing such only via CI. May 23, 2022 at 13:03
  • We are using copado for deployment. I think it is hard in copado since it's a managed package. Let me know if you have any idea May 24, 2022 at 5:05

1 Answer 1

0

As per knowledge, its not possible to show API version error message while saving the apex class.

When classes and methods are added to the Apex language, those classes and methods are available to all API versions your Apex code is saved with, regardless of the API version (Salesforce release) they were introduced in. For example, if a method was added in API version 33.0, you can use this method in a custom class saved with API version 33.0 or another class saved with API version 25.0.

Refer the help article.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .