Permissions and access · 5 min read

How to Compare Profiles and Permission Sets Between Salesforce Orgs

Published · By Edward Elliott

"Can this user do the same things in the new org as in the old one?" comes up after every migration, before every sign-off test in a sandbox, and in most security audits. Salesforce has good tools for looking at access inside one org, but none that compares two. This guide explains how a user's access adds up, what Salesforce shows you natively, and two ways to compare orgs yourself: the Metadata API and SOQL, with the traps in each.

How a user's access adds up

A user's effective access is the combination of everything assigned to them:

  • One profile. Users can have only one profile, and it still carries object, field and user permissions as well as defaults such as page layouts and login hours.
  • Any number of permission sets. They grant access but can't deny it.
  • Permission set groups. A group gives its users the combined permissions of up to 100 permission sets. A group can have one muting permission set that switches some of those permissions off, but only within that group: if the same permission arrives through the profile or another permission set, the user keeps it.
Comparing two profiles, or two permission set names, misses most of this. The comparison that matters is effective access for the same user in each org.

Profiles aren't going away, either. Salesforce once planned to retire permissions on profiles, then cancelled that retirement in 2026, while still recommending a permission-set-led model. Expect to compare orgs that use both.

What Salesforce shows you, one org at a time

  • User Access Summary. From a user's record, the access summary lists their permissions, and Access Granted By shows which profile, permission set or group grants each one. It lists only fields that support field-level security.
  • Object and field access summaries in Object Manager list every profile, permission set and group that grants access to one object or field.
  • User Access and Permissions Assistant, a free AppExchange app from Salesforce, analyzes and reports on access and converts profiles to permission sets.
  • Who Sees What Explorer, part of an Own from Salesforce package, can compare users, profiles and permission sets, within the same org.

All of these work inside a single org. To compare two, you have to pull the permissions out of each and diff them yourself.

Option 1: Retrieve the metadata and diff it

Retrieving Profile and PermissionSet metadata from both orgs with the Salesforce CLI and comparing the XML files looks like the obvious approach. It works for permission sets, but profiles have a trap that produces wrong results without any error.

  • Profiles only include what you also retrieve. Salesforce's documentation says a retrieved .profile file includes "security settings for the other metadata types referenced in the retrieve request", apart from user permissions, IP ranges and login hours. Retrieve profiles on their own and the object and field permissions are simply missing.
  • The wildcard skips standard objects. * on CustomObject doesn't match standard objects, so Account, Contact and the rest have to be listed by name.
  • Only enabled permissions appear. Object permissions are retrieved only where read access is true, and user permissions only where enabled. A missing line means "no", which a text diff shows as a deletion.
  • Deploying the result replaces, not merges. From API version 40.0, deploying retrieved permission set metadata to another org replaces the target's settings. Don't deploy a diff to "fix" an org without checking what it removes.

A manifest that retrieves profiles with the objects they refer to looks like this:

<types><members>*</members><name>Profile</name></types>
<types><members>*</members><name>PermissionSet</name></types>
<types>
    <members>*</members>
    <members>Account</members>
    <members>Contact</members>
    <members>Case</members>
    <name>CustomObject</name>
</types>

Even done carefully, this compares definitions. It tells you that two profiles differ, not what a particular user can do once their permission sets are added.

Option 2: Query effective access with SOQL

Every profile has a hidden permission set behind it: since API version 25.0, each profile is associated with a permission set that stores its object, field and user permissions (marked IsOwnedByProfile = true). So one set of queries covers profiles and permission sets alike.

Start with what's assigned to the user, including the profile's permission set:

SELECT PermissionSetId, PermissionSet.Name, PermissionSet.IsOwnedByProfile, PermissionSetGroupId
FROM PermissionSetAssignment
WHERE AssigneeId = '005XXXXXXXXXXXXXXX'

Then read the object and field permissions those permission sets grant:

SELECT Parent.Name, SobjectType, PermissionsRead, PermissionsCreate, PermissionsEdit,
       PermissionsDelete, PermissionsViewAllRecords, PermissionsModifyAllRecords
FROM ObjectPermissions
WHERE ParentId IN (SELECT PermissionSetId FROM PermissionSetAssignment
                   WHERE AssigneeId = '005XXXXXXXXXXXXXXX')

SELECT Parent.Name, SobjectType, Field, PermissionsRead, PermissionsEdit
FROM FieldPermissions
WHERE ParentId IN (SELECT PermissionSetId FROM PermissionSetAssignment
                   WHERE AssigneeId = '005XXXXXXXXXXXXXXX')

User permissions such as API Enabled or Modify All Data are fields on PermissionSet itself, and access to Apex classes, Visualforce pages and custom permissions is in SetupEntityAccess. If the user has permission set groups, PermissionSetGroupComponent lists the permission sets each group combines, including its muting permission set.

Run the same queries in both orgs, then combine the rows per object and field with OR, because a permission granted by any row is granted. Compare the two results by API name.

Traps that create false differences

  • Missing rows mean no access. Permission records exist only where access is granted; "the absence of a record indicates no access". Treat a row that exists in only one org as a difference, not as missing data.
  • Some fields never have rows. There are no FieldPermissions rows for fields such as OwnerId, master-detail fields and universally required fields; they're "assumed to always be readable and writable".
  • Modify All Data leaves odd records. Object permissions granted through it carry an invalid ID beginning with "000".
  • View All doesn't mean every field. View All Data, Modify All Data and the object-level View All and Modify All don't override field-level security; the user still needs field permissions or View All Fields.
  • Names and IDs differ between orgs. Compare by object and field API name, never by record ID. Don't rely on the names of profile-owned permission sets either: Salesforce warns their Name and Label values can change.
  • Schema differences look like permission differences. A field that exists in only one org shows up as missing access. Compare schemas first, or report those fields separately.

Compare effective access without writing the queries

Salesforce Permissions Comparison computes a user's effective permissions in each org, combining everything assigned the way Salesforce does, and diffs them across five categories with CSV export for audits.

Explore Permissions Comparison

Sources

  1. Permission Sets · Salesforce Help
  2. Permission Set Groups · Salesforce Help
  3. Muting Permission Sets · Salesforce Help
  4. Permissions in Profiles Retirement Cancelled · Salesforce Help
  5. View a User's Access Summary · Salesforce Help
  6. User Access and Permissions Assistant · Salesforce Help
  7. Compare Users, Profiles, Permission Sets, and Permission Set Groups · Salesforce Help
  8. Profile · Metadata API Developer Guide
  9. Permission Sets and Profile Settings in Change Sets · Salesforce Help
  10. PermissionSet · Salesforce Object Reference
  11. ObjectPermissions · Salesforce Object Reference
  12. FieldPermissions · Salesforce Object Reference
  13. "View All" and "Modify All" Permissions Overview · Salesforce Help

Related reading

Request a demo