+ Start a Discussion
Matthew P CraigMatthew P Craig 

How to query all of the created versions of a managed package, in the packaging org?

I have a packaging org with a managed package which has several versions.  I NEED to be able to query either the list of created package (preferred) OR verify if a specific package version has been specified.

Anyone have a way to do either of these?
Neetu_BansalNeetu_Bansal
Hello Matthew,

The following blog post talks about using METAdata API to get the list of installed packages:
http://andyinthecloud.com/2013/06/23/look-ma-no-hands-automating-install-and-uninstall-of-packages/

Another useful links
http://salesforce.stackexchange.com/questions/11620/installed-package-information-specifically-status
https://developer.salesforce.com/forums/ForumsMain?id=906F00000008zbVIAQ
http://stackoverflow.com/questions/17038495/how-can-we-get-the-installed-package-information-within-apex-controller-in-sales

I hopw this will help and if it is, please mark this as best answer.

Thanks,
Neetu
Matthew P CraigMatthew P Craig
Hello Neetu,

Thank you very much for the links however they do not answer my question, I need to find out if I can query the versions of the packages that I have CREATED in my org.  For example I have an org where I created a managed package called "Hello World" I wrote the code (a single visual force page) I packaged it and created a few versions of it, so that others can install it.  Now I need to go in and get a list of the versions that have already been created.

Here is the usecase, I have an automated code deployment pipeline here is the general overview:
  1. Feature requested / bug found (either one)
  2. Code written in dev org by developer and committed to a code repository of some kind
  3. Code is tested by an automated CI environment and approved
  4. Then manually tested by a different department (or two) and approved
  5. An authorized individual logs into our Business org (connected to the app exchange AND the packaging org of the project in question) and go to an app we created. Where they input various details of the project (approvals/dates/etc..), so they input the version number they want to create, and click "Deploy" here is the process it kicks off:
    1. We connect to the source repository and push the project to a Test environment and perform one last run of tests
    2. If all the test pass we then push the specified code to our "release org" that holds the managed package
    3. If deployment succeeds, we trigger a "build" of the package version in the packaging org (here is where we currently FAIL we are unable to detect a failure IF a version already exists.)
    4. Then tag our code repository with the version specified
    5. Then compile documentation
    6. Then update our buisness org with the status of all the activities.
Or project fails silently when the version that has been input conflicts with an existing version in the "release" org. We need a way to discover IF a version by that name already exists (patch, major, minor) prior to starting the final "deploy" process, as a validation.  A means to query the packaging org for the existence of a version (other than current) as a pre-validation would solve all the problems.