Sub topic 6
Permission Set Licences and Feature Licences
This chapter assumes you already know what a user licence and a profile are, can open Setup, and have the Manage Users permission. It covers the licences that sit beside the user licence: permission set licences (PSLs) and feature licences. You will learn what each one controls, how to check capacity, and why an assignment can fail even when the permission set looks correct.
Why a second kind of licence exists
A user licence decides which profiles a user can have and which broad set of features the user can reach. It is chosen once, when the user is created, and it is tied to the profile.
Some features cannot be covered by the user licence alone. Examples are Salesforce CPQ, Einstein features, Industries clouds, and several analytics and service add-ons. Salesforce sells these as add-ons. You can give them to some users in an org and not others, regardless of profile. Two mechanisms do this:
- A permission set licence (PSL) unlocks a bundle of permissions that a permission set may then grant.
- A feature licence is a flag on the user record that turns on a specific product feature for that person.
The user licence is the foundation. PSLs and feature licences add to it.
Permission set licences
A permission set licence is a counted entitlement. It does not grant any access itself. It makes certain permissions available, and a permission set then switches them on.
Think of two steps:
- The PSL is assigned to the user. This confirms the org has paid for the capability and reserves one seat.
- A permission set that includes those permissions is assigned to the user. This is what grants the access.
If you skip step 1, you cannot assign a permission set that depends on the PSL.
Checking PSL capacity
In Setup, open Company Information and find the Permission Set Licenses related list. It shows the status, total licences, and used licences for each PSL. You can also query it:
SELECT MasterLabel, TotalLicenses, UsedLicenses
FROM PermissionSetLicense
ORDER BY MasterLabelRemaining seats equal TotalLicenses minus UsedLicenses. Check this before you assign a permission set that needs a PSL, in the same way you check user licence capacity before you create a user.
Seeing which users hold a PSL
PSL holders are stored in the PermissionSetLicenseAssign object. This query lists them, with the licence name:
SELECT Assignee.Username, PermissionSetLicense.MasterLabel
FROM PermissionSetLicenseAssign
ORDER BY PermissionSetLicense.MasterLabel, Assignee.UsernameUse it to find users who hold a seat but may not need it.
Assigning a PSL
You can assign a PSL in two ways.
- Automatically. When a permission set requires a PSL and you assign that permission set to a user, Salesforce can assign the PSL as part of the same action, if a seat is free. This is the usual route in the Lightning UI.
- Directly. Open the user record, find Permission Set License Assignments, choose Edit Assignments, tick the licence, and save.
Which route you get depends on the PSL and the way you assign. In particular, assigning through API tools or Apex does not add a missing PSL for you. Assign the PSL first.
Removing a PSL
You cannot remove a PSL from a user while a permission set that depends on it is still assigned. Remove the permission set assignment first, then remove the PSL. Doing it in this order frees the seat for another user.
Feature licences
A feature licence is a checkbox, or a pair of settings, on the user record. Each one turns on a product feature for that person. Salesforce counts how many you have bought and how many are used, much like other licences.
Common feature licences appear on the user detail page as fields such as:
- Marketing User
- Offline User
- Flow User (Run Flows)
- Knowledge User
- Service Cloud User
- Salesforce CRM Content User
The exact list depends on what your org has purchased. A field only appears, or can only be ticked, when the org has seats for it.
Checking feature licence capacity
Feature licence counts are in Company Information, in the Feature Licenses related list. Each row shows the licence name, total licences, and used licences.
You can also query the UserPermissionsXxx fields on the user, but the counts live in UserLicense-style metadata that is easier to read in Setup. For a quick query of who has a feature turned on, use the field on User:
SELECT Name, Username
FROM User
WHERE UserPermissionsMarketingUser = true
AND IsActive = trueThis lists active users who hold the Marketing User feature licence.
Setting a feature licence
- Go to Setup, then Users, then Users.
- Open the user and select Edit.
- Tick the feature licence checkbox.
- Save.
If the box is greyed out or saving fails, the org has used all its seats for that feature, or the user's user licence does not support it. Some feature licences work only with certain user licences. For example, a Platform licence user cannot hold some Service Cloud features.
Comparing the three licence types
| Aspect | User licence | Permission set licence | Feature licence |
|---|---|---|---|
| Set on | User record, through the profile | Assignment record linked to the user | Checkbox or field on the user record |
| How many per user | Exactly one | Zero or more | Zero or more |
| Purpose | Foundation of access, limits profiles | Makes extra permissions available to permission sets | Turns on a specific product feature |
| Granted access | Indirectly, through the profile | None by itself, needs a permission set | The feature itself |
| Where counts appear | Company Information, User Licenses | Company Information, Permission Set Licenses | Company Information, Feature Licenses |
| Query | `UserLicense` | `PermissionSetLicense` | `User` fields, or Setup |
The key difference: a PSL does nothing alone, and a feature licence does something alone. A PSL needs a permission set. A feature licence takes effect as soon as it is ticked.
Common errors and how to read them
Most failures here come from three causes.
No licence seats remaining. The assignment fails with a message that the permission set licence or feature licence has no available seats. Check UsedLicenses against TotalLicenses. Free a seat by removing the licence from an inactive or unneeded user, or buy more seats. Deactivating a user releases user licences, but check whether the PSL assignments of inactive users still count in your org. Remove them explicitly if they do.
Permission set requires a licence the user lacks. The error says the permission set cannot be assigned because the user does not have the required licence. Assign the PSL first, then retry.
Licence is incompatible with the user licence. Some PSLs apply only to certain user licences. Assigning one to the wrong kind of user fails even when seats exist. Check the PSL's documentation, then either choose a different user licence at creation or a different permission set.
Assigning a PSL in Apex
You can create PSL assignments from Apex. The object is PermissionSetLicenseAssign. This snippet assigns a PSL and then a permission set that depends on it. Replace both placeholder names with real values from your org.
User u = [SELECT Id FROM User WHERE Username = '[email protected]' LIMIT 1];
PermissionSetLicense psl = [
SELECT Id, TotalLicenses, UsedLicenses
FROM PermissionSetLicense
WHERE DeveloperName = 'Your_PSL_Developer_Name'
LIMIT 1
];
if (psl.UsedLicenses >= psl.TotalLicenses) {
throw new IllegalArgumentException('No seats left for this permission set licence.');
}
insert new PermissionSetLicenseAssign(
AssigneeId = u.Id,
PermissionSetLicenseId = psl.Id
);
PermissionSet ps = [
SELECT Id FROM PermissionSet
WHERE Name = 'Your_Permission_Set_API_Name'
LIMIT 1
];
insert new PermissionSetAssignment(
AssigneeId = u.Id,
PermissionSetId = ps.Id
);The capacity check is a guard that gives a clear message. The insert would also fail without it, but with a less direct error.
A practical checklist
Before you give a user extra capabilities:
- Decide which permission set grants the access.
- Open the permission set and check whether it names a required licence.
- Check capacity in Company Information, or with the SOQL above.
- Assign the PSL if it is needed and not automatic.
- Assign the permission set.
- Tick any feature licences the user needs.
- Log in as the user, or use the Login action, to confirm the feature is visible.
Exercise
A user is assigned a permission set that includes a Salesforce add-on feature. The assignment fails and says the user lacks the required licence. List the steps you take, in order, to fix it, and say which query confirms that a seat exists.
Show answer
1. Open the permission set and note the permission set licence it requires. 2. Run SELECT MasterLabel, TotalLicenses, UsedLicenses FROM PermissionSetLicense and confirm that UsedLicenses is lower than TotalLicenses for that licence. 3. If no seats remain, free one by removing the licence from a user who no longer needs it, or buy more. 4. Assign the permission set licence to the user, either on the user record under Permission Set License Assignments or with a PermissionSetLicenseAssign record. 5. Assign the permission set again. The assignment now succeeds because the user holds the licence.
Exercise
Explain the difference between a permission set licence and a feature licence. Which one gives access with no permission set?
Show answer
A permission set licence makes extra permissions available but grants nothing itself. A permission set must then be assigned to switch the permissions on. A feature licence is a setting on the user record that turns on a product feature directly. The feature licence gives access with no permission set.