Sub topic 9
User Licenses and Permission Set Licenses
This chapter assumes you can navigate Setup, know what a profile and a permission set are, and understand that permission sets add access on top of a profile. Here you learn the layer that sits underneath those tools: licenses. A license decides which permissions can exist for a user at all. A profile or permission set can only switch on what the user's licenses allow.
Why licenses come first
Profiles and permission sets are configuration. Licenses are entitlements, meaning the rights your company purchased. Salesforce checks the entitlement before it honors the configuration.
There are two kinds of license that matter in this chapter:
- A user license is assigned once per user, through the profile. It sets the broad family of features the user can have.
- A permission set license (PSL) is assigned separately to a user. It unlocks a specific feature or set of permissions that the user license does not include.
Think of the user license as the ceiling and the permission set as the switch. If the ceiling is too low, the switch cannot be turned on.
User licenses
Every user has exactly one user license. You do not pick it on the user record directly. You pick a profile, and each profile belongs to one user license. The user license cannot be changed on an existing profile.
Common user licenses include:
| User license | Typical use |
|---|---|
| Salesforce | Full CRM users who need standard objects, custom objects, and most features |
| Salesforce Platform | Users who work with custom objects and a limited set of standard objects |
| Identity | Users who only need single sign-on and identity features |
| Customer Community and Partner Community | External users reached through an Experience Cloud site |
Which licenses appear in your org depends on what you bought. To see them, go to Setup, enter Company Information in Quick Find, and open the User Licenses related list. Each row shows the total licenses, how many are used, and how many remain.
What a user license restricts
The user license limits which objects and permissions can be granted. For example, a Salesforce Platform user cannot be given access to the Opportunity object, even if you tick every box on a permission set. The checkbox is either missing from the page or the save fails.
The same is true for system permissions. Some permissions are available only with certain user licenses, so they simply do not appear for others.
Permission sets and the user license
A permission set can be tied to a user license or left open.
- If you leave the License field empty when you create the permission set, you can assign it to users with any license. Settings that a user's license does not allow are ignored for that user.
- If you pick a license, you can assign the permission set only to users with that license. The set then offers every permission that license permits.
Choose a specific license when the permission set only makes sense for one kind of user, such as an external community user. Leave it open for general-purpose sets.
Permission set licenses
A PSL grants access to a feature that is sold as an add-on or that needs its own entitlement. A PSL does not give permissions by itself. It makes certain permissions available, and you still turn them on in a permission set.
Examples of what PSLs cover include add-on products such as Sales Cloud Einstein features, Field Service, and certain industry or analytics offerings. The exact list depends on your edition and purchases.
How a PSL works in practice
The sequence has three parts:
- Your org buys or is granted a PSL. It shows a count of total and used licenses.
- A permission set is created that includes the permissions the PSL makes available.
- The PSL is assigned to the user, and the permission set is assigned to the user.
If you assign a permission set that needs a PSL to a user who lacks that PSL, Salesforce blocks the assignment and tells you which license is missing.
Many PSLs are linked to permission sets automatically. When you assign the PSL, a managed or standard permission set that depends on it may already be present in your org. Others require you to build the permission set yourself.
Where to find and assign PSLs
- To see PSLs in your org, enter Company Information in Quick Find and look at the Permission Set Licenses related list.
- To assign one to a user, open the user record and use the Permission Set License Assignments related list.
- You can also open the PSL from Setup and see who holds it.
You can assign a PSL before or after assigning the permission set that needs it. Assign the PSL first, because the permission set assignment fails without it.
Querying and assigning licenses
You can audit PSLs with SOQL. The objects involved are PermissionSetLicense for the license itself and PermissionSetLicenseAssign for the link to a user.
This query lists who holds each PSL:
SELECT Assignee.Name, PermissionSetLicense.MasterLabel
FROM PermissionSetLicenseAssign
ORDER BY PermissionSetLicense.MasterLabel, Assignee.NameThis query shows how many licenses are used and how many remain:
SELECT MasterLabel, TotalLicenses, UsedLicenses
FROM PermissionSetLicense
ORDER BY MasterLabelTo assign a PSL in Apex, insert a PermissionSetLicenseAssign record. This example looks up the license by its developer name. Replace the name with one that exists in your org.
PermissionSetLicense psl = [
SELECT Id
FROM PermissionSetLicense
WHERE DeveloperName = 'SalesforceCPQ_CPQStandardPerm'
LIMIT 1
];
User u = [SELECT Id FROM User WHERE Username = '[email protected]' LIMIT 1];
insert new PermissionSetLicenseAssign(
AssigneeId = u.Id,
PermissionSetLicenseId = psl.Id
);The insert fails if no licenses remain or if the user already holds that PSL. Both are normal outcomes, so handle them in real code.
Common errors
Most license problems show up as an assignment that will not save, or a permission that never appears. These are the cases you will meet most often.
- The permission is missing from the permission set page. The permission set's license, or the user's license, does not allow it. Check the License field on the permission set, then check the user's profile license.
- "The user license doesn't allow the permission" on save. You tried to enable a permission that the license excludes. Remove it, or use a profile with a different license.
- A permission set will not assign to a user. Either the set is tied to a different user license, or it needs a PSL that the user does not hold.
- Assignment fails because no licenses are left. The used count equals the total. Free a license by removing the PSL from a user who no longer needs it, or buy more.
- A deactivated user still holds a license. Deactivating a user frees a user license. A PSL assignment can remain until you remove it, so clean it up if you need the seat back.
Design guidance
A few habits keep license handling predictable.
- Name permission sets for the feature or job function, and note the required license in the description.
- Leave the License field empty on general permission sets, so they work for any user.
- Create a separate permission set for each PSL-dependent feature. This makes it easy to see who uses the feature and why.
- Review used and remaining counts on a schedule, because a full license pool blocks onboarding without warning.
- Combine PSL-dependent permission sets into a permission set group only if every member of the group will hold the PSL. Otherwise assignment of the group can fail or leave users with partial access.
Summary
A user license is set through the profile and caps what the user can ever hold. A permission set license is assigned separately and unlocks add-on features. Permission sets turn those features on. When a permission is missing or an assignment fails, check the licenses before you check the configuration.
Exercise
A user with the Salesforce Platform license is assigned a permission set that grants Read on Opportunity. The user still cannot see Opportunities. Give a likely cause and one way to confirm it.
Show answer
The Salesforce Platform user license does not include the Opportunity object, so the permission cannot take effect. Confirm it by checking the license on the user's profile, then looking at the object list for that license, or by trying to enable the permission on a permission set tied to that license and seeing that it is not offered.
Exercise
Write a SOQL query that shows each permission set license with the number of unused seats.
Show answer
SELECT MasterLabel, TotalLicenses, UsedLicenses FROM PermissionSetLicense. Unused seats are TotalLicenses minus UsedLicenses, and you calculate that difference in your code or a report, because SOQL does not subtract fields in the SELECT list.