Sub topic 4
Profiles and their link to licences
This chapter assumes you know what a user licence is (covered earlier in this tutorial). It also assumes you can open Setup and run a SOQL query in the Developer Console. After reading it, you should be able to explain how a profile relates to a licence, find the licence behind any profile, and choose the right profile when creating a user.
The working model
A user record needs two access decisions: which licence it consumes and which profile it uses. The two are linked.
- A user licence sets the ceiling. It decides which kinds of objects, features and permissions the user can ever receive, and it counts against your purchased capacity.
- A profile is a named bundle of settings. It sits under that ceiling and decides what the user can do by default.
Every user has exactly one profile. Every profile belongs to exactly one user licence. So a user's licence is not a separate choice. It follows from the profile you pick.
The dotted line shows that permission sets add access on top of the profile. They are covered in the next chapter.
What a profile controls
A profile holds many kinds of settings. Some of the most common are:
- Object permissions (create, read, edit, delete) and field-level security
- Which apps and tabs are visible
- Page layout and record type assignments
- System permissions, such as Manage Users or Export Reports
- Access to Apex classes and Visualforce pages
- Login hours and login IP ranges
- Password policies that override the org defaults
The licence limits which of these can be switched on. For example, a profile on the Salesforce Platform licence cannot be granted object permissions for standard objects such as Opportunity or Forecast, because the licence does not include them. The checkbox may not appear at all, or it may be fixed off. If a permission is missing from a profile, check the licence before you assume a bug.
Finding the licence behind a profile
In Setup, open Profiles and look at the User License column. You can also query it. This lists every profile with its licence:
SELECT Id, Name, UserLicense.Name
FROM Profile
ORDER BY UserLicense.Name, NameThe Id column gives the 15 or 18 character profile ID you need later for Data Loader files and Apex.
To see how many active users sit on each profile, use an aggregate query:
SELECT Profile.Name, COUNT(Id) total
FROM User
WHERE IsActive = true
GROUP BY Profile.Name
ORDER BY COUNT(Id) DESCRun this before you retire or change a profile. A profile with active users cannot be deleted, so the result tells you how many users to move first.
Standard and custom profiles
Salesforce ships standard profiles for each licence. Examples are Standard User, System Administrator, Read Only and Standard Platform User. Which ones you see depends on the licences in your org.
Standard profiles have limits:
- You can change only a few settings on them, such as some page layout assignments and login hours.
- You cannot change their object permissions in the same way you can on a custom profile.
- Salesforce can change what they contain between releases.
For these reasons, most admins do not assign standard profiles to business users. They clone one and edit the copy.
Cloning a profile
- In Setup, go to Profiles and click New Profile.
- In Existing Profile, choose the profile to copy.
- Enter a Profile Name, such as
Sales Rep Base. - Click Save, then edit the permissions.
The clone inherits the licence of the source profile. You cannot pick a different licence while cloning, and you cannot change a profile's licence afterwards. If you need the same settings under another licence, clone from a profile that already uses that licence and re-apply the settings.
How profile and licence interact when you create a user
On the New User page, you choose the User License first. The Profile list then shows only profiles that belong to that licence. If a profile is missing from the list, the licence you picked is probably wrong.
Creating the user consumes one licence of that type. If none are left, saving fails. Chapter 3 covered how to check capacity before this point.
Changing a user's profile later
You can edit a user and select a different profile. The result depends on the licences involved:
| Change | What usually happens |
|---|---|
| Another profile on the same licence | Allowed. Access changes as soon as you save. |
| A profile on a different licence | Allowed only for supported combinations. Consumption moves from one licence to the other, so the new licence needs free capacity. |
| A profile with fewer permissions | Allowed. The user loses access immediately, and records they own stay with them. |
Some licence changes are blocked when the user holds data or settings that the new licence cannot support. Test the change on one user in a sandbox before you move a group of users.
Profiles versus permission sets
A profile is the one required setting. A permission set is optional and you can assign many of them. This difference drives good design:
| Row | Profile | Permission set |
|---|---|---|
| Per user | Exactly one | Zero or many |
| Tied to a licence | Yes, always one | Optional. Some require a permission set licence. |
| Can remove access | Yes, by being more restrictive | No, it can only add access |
| Best use | Baseline for a group of users | Extra access for some users |
Because permission sets only add access, the common pattern is a restrictive baseline profile plus permission sets for extras. Keep the number of profiles small. Ten near-identical profiles are costly to maintain, and a change then has to be repeated in each one.
Common mistakes
- Choosing System Administrator for convenience. It grants every permission and consumes a full licence. Use it only for real administrators.
- Editing a standard profile and expecting it to stay stable. Clone it and edit the clone.
- Looking for a profile under the wrong licence. The profile list is filtered by the licence you picked. Change the licence, not the profile.
- Trying to delete a profile in use. Move or deactivate its users first. The aggregate query above finds them.
- Putting one-off access into the profile. This widens access for everyone on the profile. Use a permission set for that user instead.
Summary
A profile belongs to exactly one licence, and a user has exactly one profile. The profile you choose therefore decides which licence the user consumes and what baseline access they have. Pick a restrictive profile, and add access with permission sets.
Exercise
You are creating a user and the profile Platform - Operations Base does not appear in the Profile list on the New User page. The User License field is set to Salesforce. What is the most likely cause, and how do you fix it?
Show answer
The profile belongs to a different licence (for example Salesforce Platform), and the Profile list shows only profiles for the selected licence. Change the User License field to the licence the profile belongs to, then select the profile. You can confirm the licence with the query SELECT Name, UserLicense.Name FROM Profile WHERE Name = 'Platform - Operations Base'.
Exercise
A colleague wants to move a custom profile from the Salesforce licence to the Salesforce Platform licence by editing the profile. Why is this not possible, and what do you do instead?
Show answer
A profile's licence is fixed when the profile is created, and a clone inherits the licence of its source. Clone a profile that already uses the Salesforce Platform licence, re-create the needed permissions on the clone, and then move the users to it, checking that the Platform licence has free capacity.