Newer Version Available
PackageLicense
Represents a license for an installed managed
package.
This object is available in API version 31.0 and later.
Fields
| Field Name | Details |
|---|---|
| AllowedLicenses |
|
| ExpirationDate |
|
| IsAvailableForIntegrations |
|
| NamespacePrefix |
|
| Status |
|
| UsedLicenses |
|
Usage
Use this object to determine the number of licenses allowed and in use for a managed package installed in your organization.
The following example demonstrates the use of the API to manage licenses for
a package. The example defines an Apex class that does the following.
- Retrieves the PackageLicense record for the specified package (identified by its namespace prefix).
- Defines a function that returns a list of all users with the specified profile.
- Creates a UserPackageLicense record for each user with that profile, which has the effect of assigning a license for the package to all users with that profile.
- Returns an error message if the number of users exceeds the number of available licenses.