3

In an org that releases a managed package, the package detail page lists the components in the package (recently added components, previously released components, indirectly added components).

Is it possible to query this list through an API?

I had hoped I would get this by extracting the package through the MDAPI (i.e. sfdx force:mdapi:retrieve --packagenames MYPACKAGE --singlepackage) but that seem to only return components added directly and ignore indirectly added components.

Thanks

2 Answers 2

0

A bulk retrieve operation in the Metadata API using the packageNames argument will retrieve all the metadata that's included in the package itself. That's the mechanism sdfx is using to fetch the packaged metadata.

The package.xml you get from the retrieve will list all metadata components in the package individually.

As for dependencies on other managed package versions, you could parse the *-meta.xml files from the retrieve and look for elements like this which contain the dependencies:

<packageVersions>
    <majorNumber>3</majorNumber>
    <minorNumber>11</minorNumber>
    <namespace>npe01</namespace>
</packageVersions>

You can parse that this particular Apex Class depends on the managed package with namespace npe01 being installed at version 3.11

-3

we had a somewhat similar requirement to retrieve metadata components from any specific managed package in a Salesforce org. Please follow the steps given in the below link. It uses the listMetadata task of Force.com migration tool to retrieve the list of names of all the components of any metadata type from the org followed by filtering out the components name using the managed package namespace and then using Force.com migration tool again to retrieve the filtered out components. Hope it helps.

Retrieve list of components of any metadata type from a managed package

2
  • 1
    you will probably want to include the essentials of the link in your answer for it to ba considered as 'acceptable' as links may become invalid in the future. please udpate accordingly. thanks
    – glls
    Commented Aug 28, 2018 at 17:12
  • Oops my bad. Thanks for pointing it out glls. Much appreciated. i have updated my comment. Thanks.
    – sontusfdc
    Commented Aug 28, 2018 at 17:28

You must log in to answer this question.

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