Newer Version Available
PackageSubscriber
Represents an installation of a package in an org. This object
contains installation information for managed packages developed in the org you’re
logged in to.
One record is created per installation. For example, if 5 orgs installed 2 packages, 10 records are created.
Supported Calls
describeSObjects(), query(), retrieve()
Fields
| Field Name | Details |
|---|---|
| InstalledStatus |
|
| InstanceName |
|
| MetadataPackageId |
|
| MetadataPackageVersionId |
|
| OrgKey |
|
| OrgName |
|
| OrgStatus |
|
| OrgType |
|
| ParentOrg |
|
Usage
Here are examples of the types of API queries you can perform.
| Query | String |
|---|---|
| Get all package subscriber orgs with a specific package ID | SELECT Id, OrgKey, OrgStatus, OrgName, OrgType FROM PackageSubscriber WHERE MetadataPackageVersionId = '04t...' |
| Get all package subscriber orgs that have an installed package created by the org you’re logged in to | SELECT Id, OrgKey, OrgStatus, OrgName, OrgType FROM PackageSubscriber WHERE InstalledStatus = 'i' |
Filter PackageSubscriber Objects by Instance
If you have packages with many subscribers, querying PackageSubscriber objects can take a while. To improve query performance, add filters to your PackageSubscriber queries, such as an InstanceName filter. InstanceName is a field that represents the instance that the subscriber org is hosted on.
- Get the org’s managed package and the latest released version of the
package.
- Get eligible subscribers. The following query strings and methods are modified
to allow querying for PackageSubscribers filtered by an
instance.
- Put it all together. The following code sample shows how to use the previous
methods to modify the workflow to perform package pushes by
instance.