Home SALESFORCEAPEX How many list of users assigned into the Salesforce Permissionset

How many list of users assigned into the Salesforce Permissionset

This post describes about to get the list of counts assigned to the users into the Salesforce Permissionset.

A permission set is a collection of settings and permissions to assign the users to extend the users access without changing their Salesforce Profiles, we can assign many Permissionset to single users or other word that one user have the many Salesforce Permissionser but user have only one profile.

Currently there is no possibility to generate using Standard Salesforce Report and there is an Idea from Success.Salesforce Community (please register your upvote) also salesforce suggested to use with Salesforce Labs appexchange called  “Profile and Permission Set Helper” as an alternative solution – https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000FeF99UAF

Still possible with other workaround using SOQL or Data Loader or Workbench or Apex Class from “PermissionSet” and “PermissionSetAssignment” Standard Objects, below are some examples to identify the list of users assigned to the Salesforce Permissionset

Example 1:

How many users assigned to Each Salesforce Permissionset?

SELECT PermissionSet.Name, count(AssigneeId) FROM PermissionSetAssignment Group by PermissionSet.Name Order by PermissionSet.Name ASC

Example 2:

How many Salesforce Permissionset assigned to the Specific Users?

SELECT count(PermissionSet.Name) FROM PermissionSetAssignment WHERE AssigneeId = ‘0050K00000AygOu’

Here AssigneeId is SALESFORCE USER ID

Example 3:

How many users assigned to the Specific Salesforce Permissionset?

SELECT count(Id) FROM PermissionSetAssignment WHERE PermissionSet.Name = ‘Case_Admin’

Here PermissionSet.Name is SALESFORCE Permissionset API Name

Example 4:

List of users assigned to the Specific Salesforce Permissionset?

SELECT AssigneeId, count(Id) FROM PermissionSetAssignment WHERE PermissionSet.Name = ‘Case_Admin’ Group by AssigneeId

Here PermissionSet.Name is SALESFORCE Permissionset API Name

Example 5:

Extract using data loader or workbench to identify the Salesforce Permissionset and User Assignment.

Export the csv file from PermissionSetAssignment object and store the csv file and filter based on PermissionSet Name or Assignee Name to identify the Count

SELECT Id, PermissionSetId, PermissionSet.Name, AssigneeId, Assignee.Name FROM PermissionSetAssignment

 

Example 6:

Using Apex Class to Identify the list of users assigned to the Salesforce Permissionset?

AggregateResult[] psAssignmentList = [SELECT PermissionSet.Name pName, count(AssigneeId) assignCnt
FROM PermissionSetAssignment
Group by PermissionSet.Name
Order by PermissionSet.Name];
for (AggregateResult psa : psAssignmentList) {
System.debug(‘PermissionSet Name::’ + psa.get(‘pName’) +’::User Count::’+psa.get(‘assignCnt’));
}

 

References:

Using SOQL to Determine Your Force.com User’s Permissions – https://developer.salesforce.com/blogs/engineering/2012/06/using-soql-to-determine-your-users-permissions-2.html

Ability to report on Users’ Permission Set Assignments – https://success.salesforce.com/ideaView?id=08730000000glw0AAA

Profile and Permission Set Helper from Salesforce Labs Appexchange – https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000FeF99UAF

You may also like

Leave a Comment