7

I have, a Salesforce packaging org, it contains a managed package with a namespace.

I need to be able to query the list of created versions for that managed package.

I am aware that a user can go to the package and click on versions, and manually see them. I need to know how to do this programmatically. Either via APEX/DML/SOQL/SOSL/API/other.

The use case: I have an automated deployment pipeline that gets initiated by a user, they specify the version of the package they intend to build in a SEPARATE org. I need to verify the version they have entered does not already exist prior to starting the automation.

----- EDIT ------

I see someone linked a previous post about getting the version of the installed managed packages, I am not looking for installed managed packages (a package installed from somewhere other than me, like the app exchange). I'm looking for the versions of packages (code) that I maintain and distribute to others as installed managed packages. Unless there is something I'm missing the other link does not solve my problem.

  • Possible duplicate of Querying Managed package version from Apex – battery.cord Nov 21 '17 at 17:41
  • 1
    I don't think so, the issue there looks like they are trying to get the version of an installed package, not a list of package versions they manage, unless I'm miss understanding the other post. @battery.cord – Matthew Craig Nov 21 '17 at 17:48
  • Thanks for adding some additional clarifications- I've retracted my close vote. – battery.cord Nov 21 '17 at 18:00
2

Have a look at MetadataPackageVersion (keyprefix 04t) in the Tooling API.

Represents a package version (managed or unmanaged) that has been uploaded from the org you’re logged in to. Available in Tooling API version 38.0 and later.

You might also need the parent MetadataPackage.

Represents a managed or unmanaged package that has been developed in the org you’re logged in to. Available in Tooling API version 38.0 and later.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.