PermissionSetLicenseDefinition defines a custom permission set license that entitles specified features in a package. It controls licensed custom objects and custom permissions, eligible user-license categories, trial provisioning defaults, and package access after license expiration.
This type describes the license definition, not an individual user's license assignment. Its object and custom permission entries describe feature entitlements; they do not replace the referenced component definitions.
Key Elements
| Element | What the Element Controls |
|---|---|
fullName |
The component's metadata identity, inherited from Metadata. This is distinct from the license name in label. |
label |
Required. The name of the permission set license definition. |
componentAccess |
Required. How licensed components are accessed. Allowed values are Namespace and None. |
customObjects |
Licensed custom-object entries and their create, read, update, and delete (CRUD) entitlements. Each entry requires a name that includes the __c suffix. |
customPermissions |
Licensed custom permission entries. Each entry's name references a CustomPermission whose isLicensed field must be true. |
defaultTrialLengthInDays |
Required integer. The default duration of a trial, in days. |
defaultTrialLicenseCount |
Required integer. The default number of licenses provisioned for a trial. |
licenseExpirationPolicy |
Controls package access for existing users when all custom permission set licenses expire. Values are BlockNamespaceAccess, the default, and AllowNamespaceAccess. |
userLicenseRestrictions |
Limits assignment eligibility by user-license category. If no categories are specified, all users can be assigned the custom permission set license. |
Behavior and Constraints
componentAccess and licenseExpirationPolicy control different things. The first specifies how licensed components are accessed. The second determines whether existing users retain package access when all custom permission set licenses expire:
-
BlockNamespaceAccessblocks package access for existing users and is the default. -
AllowNamespaceAccessdoes not block package access for existing users.
Do not interpret the expiration policy as a rule triggered whenever any single license expires. Its documented condition is expiration of all custom permission set licenses, and its stated scope is existing users.
Each customObjects entry uses allowCreate, allowDelete, allowRead, and allowUpdate to describe the CRUD entitlements included in the license. These flags belong to the license's object entry, not to the custom object's definition.
Each customPermissions entry must reference a licensed custom permission. An existing CustomPermission is not sufficient unless its isLicensed field is true.
userLicenseRestrictions identifies eligibility categories, not particular users. Documented category tokens include ${communities}, ${communitiesLogin}, ${customerCommunities}, ${customerCommunitiesLogin}, ${internal}, ${partnerCommunity}, ${partnerCommunityLogin}, and ${platform}. For the licensing context, see Understand Permission Set Licenses.
defaultTrialLengthInDays and defaultTrialLicenseCount are provisioning defaults. They do not establish an actual trial's start or end dates, or its current license count.
Deployment and Retrieval
Components are stored in the permissionSetLicenseDefinitions folder with the suffix .permissionSetLicenseDefinition. In the package.xml manifest, use PermissionSetLicenseDefinition as the type name. The type supports the * wildcard for selecting components.
The required top-level fields are componentAccess, defaultTrialLengthInDays, defaultTrialLicenseCount, and label. For licensed features, check the nested entries as well: object entries require name, and custom permission references must point to components configured with isLicensed set to true.
A custom object's name must include __c in metadata, for example Widget__c. Salesforce stores the value internally without that suffix and adds the suffix when retrieving the metadata. Keep the suffixed form in the component file; the internal representation is not the required metadata format.
The nested object and custom permission entries do not supply the referenced component definitions. Treat those definitions as separate dependencies rather than assuming that including them in this license definition creates them.
Relationships
The feature dependencies are the custom objects and custom permissions named inside the license definition. User-license restriction tokens describe assignment eligibility rather than references to individual user records.
References
-
CustomObject:customObjectsentries identify the licensed object throughnameand describe its CRUD entitlements. -
CustomPermission:customPermissionsentries reference the component throughname. The referenced component must haveisLicensedset totrue.
Common Questions
Does PermissionSetLicenseDefinition assign a license to a user?
No. It defines the license's feature entitlements, assignment eligibility, trial defaults, and expiration behavior. It does not represent an individual user's license assignment.
Why is an existing custom permission not enough for this license definition?
The referenced CustomPermission must also have isLicensed set to true. Referencing it by name does not make it licensed.
Does one expired custom permission set license block package access?
The documented trigger for licenseExpirationPolicy is expiration of all custom permission set licenses. Under that condition, BlockNamespaceAccess blocks package access for existing users, while AllowNamespaceAccess does not.
Why does a retrieved custom object name include __c?
The metadata requires the __c suffix. Salesforce stores the name internally without it and restores it during retrieval, so a name such as Widget__c is the expected metadata form.
Which users are eligible if userLicenseRestrictions is omitted?
If no user-license categories are specified, all users can be assigned the custom permission set license. Specifying categories limits assignment eligibility; it does not assign the license to users.