1

I want to know version number of managed packages installed.

I have identified two ways to get that information as shown below but they are not supported in API Version 29.0.

Approach 1: Query Publisher object

Approach 2: Using System.requestVersion()

So, I want to know is there any way to fetch package version details from Apex class which is created with API Version 29.0

4
  • 1
    Why does the class need to remain at v29.0? It seems the easy solution is to upgrade the API version.
    – sfdcfox
    May 13 '19 at 15:33
  • Actually, my apex class is very big and was created by someone else. So, I am not sure what it impacts on upgrading API Version. So, I want to avoid upgrade if possible.
    – rakesh
    May 14 '19 at 6:34
  • One more thought came in my mind, if it is possible - Create new static class with latest API Version and then create one static method which gives me package version. And then, call this method from my existing class. Will it work?
    – rakesh
    May 14 '19 at 6:37
  • "Maybe." I've discussed why mixing API versions is a bad idea, and generally discourage it. It may work, or it may introduce new bugs. Also, the Publisher object, for example, still won't be available in the other class, so you'd need a custom wrapper. If you have proper unit tests, changing API version should be safe, and if you don't have proper tests, consider writing them now.
    – sfdcfox
    May 14 '19 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.