Sub topic 8
Granting Access with Permission Sets
This chapter covers how to give people access to an installed AppExchange app with permission sets, so each person gets only what the job needs. It assumes you know basic Salesforce administration: Setup, profiles, and how a sandbox differs from production. It also assumes you have already picked an install option, as covered in the previous chapter.
Why permission sets are the right tool
A profile is a base set of permissions that every user has exactly one of. A permission set is an additional bundle of permissions that you can assign to any number of users, and a user can hold many of them. Profiles can only grant access. Permission sets are also additive, so assigning one never removes a permission the user already has.
For installed apps, permission sets have three advantages:
- The publisher ships them inside the package, so they are already scoped to the app's objects, fields, Apex classes, and tabs.
- You can assign and remove them without editing a profile, which keeps the change small and easy to reverse.
- You can give one person access without touching anyone else.
The least-privilege approach is simple. Install with access limited to administrators, then assign permission sets to the specific people who need the app. This avoids the "all users" install option, which can grant broad access in one step.
What an app's permission sets contain
Open Setup, search for Permission Sets, and look for the sets whose namespace matches the package. Managed packages show a namespace prefix on their components. A typical app ships several sets, such as an admin set, a standard user set, and a read-only set. Names and contents vary, so read each one before assigning it.
For each permission set, check these areas:
| Area | What to look for |
|---|---|
| Object Settings | Which objects get Read, Create, Edit, Delete, View All, and Modify All |
| Field permissions | Which fields are readable or editable, especially on standard objects like Account and Contact |
| System Permissions | Powerful flags such as API Enabled, View All Data, Modify All Data, or Manage Users |
| Apex Class Access | Which of the package's classes the user can run |
| Custom Permissions | Feature switches that the app checks in its own logic |
| Assigned Apps and Tabs | Which apps and tabs are visible |
Watch for View All Data and Modify All Data in particular. They bypass sharing rules and record-level restrictions, so a permission set that contains them gives the holder access to every record in the org. If a standard user set has them, ask the publisher why. Then compare the answer with what the listing and documentation claim.
Permission sets and permission set groups
A permission set group bundles several permission sets under one name. You assign the group, and the user receives the combined permissions of all sets in it. Groups help when an app needs several sets for a single role, for example a core app set plus a set that covers a separate integration feature.
Two behaviors matter when you use groups:
- Permissions combine as a union. If any set in the group grants a permission, the user has it.
- A muting permission set lets you switch off specific permissions inside a group without editing the original sets. This is useful because packaged permission sets from a managed package cannot be edited by you, and a package upgrade can overwrite changes to anything you could edit.
If you cannot edit a packaged permission set, create your own set, or a group with a muting set, and assign that instead. Your changes then survive upgrades.
Permission set licenses and package licenses
Some permission sets cannot be assigned until the user has the right license. There are two kinds to keep apart:
- A package license controls whether a user can use a licensed managed package. It is counted against the seats the publisher sold you. You manage these under Installed Packages, then Manage Licenses.
- A permission set license is a Salesforce-defined license that unlocks a feature family, and a permission set can require one.
When an assignment fails, the cause is often a missing license and not a missing permission. Check the licensing first.
The access path from install to a working user
A user can only use the app when several layers line up. Missing any one of them produces a "no access" experience.
Use this order when you troubleshoot. It separates a licensing problem from a permissions problem, and both from a sharing problem.
Assigning access in a sandbox
Test the assignment in the sandbox where you already installed the package. Use one test user with a realistic profile, not your own administrator account. An administrator already has broad rights, so testing as one hides missing-permission problems.
The CLI command below assigns one permission set to one test user. Replace the permission set name with the real API name from the app, and use the username of your test user.
sf org assign permset --name Example_App_User --target-org my-sandbox --on-behalf-of [email protected]Details to know:
--nametakes the permission set's API name, not its label. If the set comes from a managed package, the API name includes the namespace prefix, for exampleacme__Example_App_User.--on-behalf-ofnames the user who receives the assignment. Without it, the command assigns the permission set to the user you are logged in as.- The
--on-behalf-offlag can be repeated, so you can assign the same set to several users in one command. - The command fails if the user lacks a required license, and the error message names the problem.
You can also assign from Setup. Open the permission set, choose Manage Assignments, then Add Assignments. Use the UI for a one-off change and the CLI when you want a repeatable, scripted step that you can run again in production.
Verifying the result
Do not assume the assignment worked. Confirm it, then test it from the user's point of view.
- In Setup, open the permission set and choose Manage Assignments to confirm the test user is listed.
- Open the user record and check the Permission Set Assignments related list.
- Use Login As, if your org allows it, or sign in as the test user directly. Open the app and perform the main tasks.
- Try an action the user should not be able to do, such as deleting a record or opening an admin tab. It should fail.
- Check a record the user should not see, to confirm sharing still restricts it.
The negative tests in steps 4 and 5 matter as much as the positive ones. A permission set that works but also allows too much is the failure you are trying to catch.
You can query assignments with SOQL for a precise audit. This query lists which users hold a given permission set:
SELECT Assignee.Username, PermissionSet.Name, PermissionSet.NamespacePrefix
FROM PermissionSetAssignment
WHERE PermissionSet.Name = 'Example_App_User'Run it in the Developer Console query editor or with sf data query. Include the namespace prefix in your filter if the set belongs to a managed package. Every user also has an assignment row for a profile-owned permission set. You can ignore it by adding AND PermissionSet.IsOwnedByProfile = false.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| The app does not appear in the App Launcher | The permission set does not include the app or tab visibility | Check Assigned Apps and the tab settings in the set |
| A tab shows but a page says insufficient privileges | Object or Apex class access is missing | Add the object permission or class access in your own set |
| Assignment fails with a license error | The user has no package license or permission set license | Assign the license first, then retry |
| The user sees the app but no records | Sharing, not permissions, hides the records | Review the org-wide defaults and sharing rules |
| Access disappeared after an upgrade | You edited a set that the upgrade replaced | Move your changes to your own set or a muting set |
| A command reports that the permission set is not found | You used the label, or you left off the namespace prefix | Use the full API name |
Keeping the setup maintainable
Small habits keep access under control over time:
- Name your own permission sets and groups after the role, for example "Sales Rep - Example App", and write the purpose in the description.
- Keep a short record of which role gets which set. This is the input for the access review in the monitoring chapter.
- Assign by role through groups where several sets belong together, and avoid one-off assignments you will forget.
- Remove assignments when someone changes role. Permission sets accumulate quietly, and old ones are a common source of excess access.
- Repeat the sandbox test with the least-privileged user before you copy the same assignments to production.
Exercise
A standard-user permission set from a managed app includes View All Data. You want your sales team to use the app. What do you do, and why not just assign the set?
Show answer
Do not assign the set as shipped. View All Data lets the holder read every record, bypassing sharing rules. Ask the publisher why it is needed and check the documentation. If the app works without it, create your own permission set (or a permission set group with a muting set) containing only the object, field, class, and tab access the sales role needs, and assign that. Test with a realistic non-admin user in the sandbox, including a negative test on a record the user should not see. Your own set also survives package upgrades, which a packaged set may not.
Exercise
You assign a permission set to a test user. The user sees the app tab but gets "insufficient privileges" on the page. Using the access path in this chapter, list the first two things to check.
Show answer
First, confirm the user has the package license and that the permission set assignment is listed on the user record. Second, check that the set grants the object permissions and Apex class access the page needs. If both are correct, check record sharing last, because sharing usually causes hidden records and not an insufficient privileges error.