Monday, July 5, 2021

Salesforce : Query to find Permission sets assigned to users

 It is sometimes taken for granted that we need to reconcile permissions or permission sets.

It is crucial to ensure that we can audit our environments and ensure that are able to retrieve the required information quickly.


Below is the SOQL query we can create using Workbench, developer console or dataloader  to capture the Permission Sets associated with a given User or Profile via the Permission Set Assignment object.

SELECT Id, PermissionSetId, PermissionSet.Name, PermissionSet.ProfileId, PermissionSet.Profile.Name, AssigneeId, Assignee.Name FROM PermissionSetAssignment WHERE Assignee.Name = 'Joe Soap'

You would need to update the Assignee name as required.


Or retrieve all users associated with a specific PermissionSet like:

SELECT Id, PermissionSetId, PermissionSet.Name, PermissionSet.ProfileId, PermissionSet.Profile.Name, AssigneeId, Assignee.Name FROM PermissionSetAssignment WHERE PermissionSet.Name = 'My Permission set'


I will start my auditing series so let me know if you have any specific questions.


May the Force be with you


Generate reports from Opportunities using a Visualforce Page in Salesforce

  Step 1: Create a Visualforce Page Go to the Setup menu in Salesforce. Search for "Visualforce Pages" in the Quick Find box and c...