Newer Version Available

This content describes an older version of this product. View Latest

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
Type
picklist
Properties
Filter, Group, Nillable, Restricted picklist, Sort
Description
If the package is installed in the org, the value is i.
InstanceName
Type
string
Properties
Filter, Group, Nillable, Sort
Description

The instance that hosts the subscriber org.

MetadataPackageId
Type
reference
Properties
Filter, Group, Nillable, Sort
Description
The package ID. Package Ids have a prefix of 033. This field is available in API version 49.0 and later.
MetadataPackageVersionId
Type
reference
Properties
Filter, Group, Nillable, Sort
Description
The 18-character package version ID starting with 04t.
OrgKey
Type
string
Properties
Filter, Group, Nillable, Sort
Description

The 18-character ID that represents the Salesforce org.

OrgName
Type
string
Properties
Filter, Group, Nillable, Sort
Description

The name of the org where the package is installed.

OrgStatus
Type
picklist
Properties
Filter, Group, Nillable, Restricted picklist, Sort
Description
Valid values are:
  • Active
  • Demo
  • Free
  • Inactive
  • Trial
Orgs with an OrgStatus of Inactive can’t receive push upgrades.
OrgType
Type
picklist
Properties
Filter, Group, Nillable, Restricted picklist, Sort
Description
Valid values are:
  • Production
  • Sandbox
ParentOrg
Type
string
Properties
Filter, Group, Nillable, Sort
Description
The production org from which a sandbox was created.

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.

  1. Get the org’s managed package and the latest released version of the package.
  2. Get eligible subscribers. The following query strings and methods are modified to allow querying for PackageSubscribers filtered by an instance.
  3. 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.