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.

3
  • Possible duplicate of Querying Managed package version from Apex Commented Nov 21, 2017 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 Commented Nov 21, 2017 at 17:48
  • Thanks for adding some additional clarifications- I've retracted my close vote. Commented Nov 21, 2017 at 18:00

1 Answer 1

3

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.

You must log in to answer this question.

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