I'm querying the tooling API via some external C# code to get a list of installed packages.
SELECT SubscriberPackage.Name, SubscriberPackage.NamespacePrefix, SubscriberPackageVersionId FROM InstalledSubscriberPackage
On some orgs, I get the error INVALID_TYPE: sObject type 'InstalledSubscriberPackage' is not supported
.
How do I make the InstalledSubscriberPackage
object available?
I'm not sure what the differentiating factor is for whether InstalledSubscriberPackage
exists.
I've ran the query successfully against:
- non-DevHub orgs
- DevHub orgs
- developer orgs
- sandbox orgs
- scratch orgs
I suspect that there's a setting I need to enable or permission I need to grant to make the InstalledSubscriberPackage
object available, but I can't find what.
Best Answer
The user needs to have the
Download AppExchange Packages
permission in their profile.If they have the permission, the query on the tooling API returns records from
InstalledSubscriberPackage
.If the user does not have the permission, they'll get the error
Credit to @DanielBallinger for pointing me in the right direction here.