function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Daniel KDaniel K 

Find user's assigned with a particular permission set

Hi All,
           How can I find all the user's who are assigned with a particular permission set ?
Best Answer chosen by Daniel K
Dmitry OfitserovDmitry Ofitserov
Hi Daniel,
Please try to use the following SOQL:
SELECT AssigneeId FROM PermissionSetAssignment WHERE PermissionSet.Name = 'your_permission_set_name'

Hope it helps.

All Answers

Dmitry OfitserovDmitry Ofitserov
Hi Daniel,
Please try to use the following SOQL:
SELECT AssigneeId FROM PermissionSetAssignment WHERE PermissionSet.Name = 'your_permission_set_name'

Hope it helps.
This was selected as the best answer
Daniel KDaniel K
I know that that this PS is assigned to few user's but when queried, the query returned 0 results.
GauravendraGauravendra
Hi Daneil,

Make sure you are passing the API name of permission set in query.
Dmitry OfitserovDmitry Ofitserov
Did you use the Permission Set API name in the query ?
Anyway, try the following : SELECT AssigneeId,PermissionSet.Name FROM PermissionSetAssignment
Thus you will receive a result containing all the permission set names.
Daniel KDaniel K
Thanks, previously I queried wrongly.
 
Nikhil SInghania 18Nikhil SInghania 18

Hi All,

How to get map<userd, list<Permissionset Assigned to this user>>  ?
 

jitendra sharma 23jitendra sharma 23
Hi All , as per Dmitry Ofitserov comment it will give 0 result because you did nota dd field to SOQL, here is the correct one
select Assignee.Name, PermissionSet.Name
from PermissionSetAssignment
where  PermissionSet.Name='TEST_PER_SEt_Name' ,.
mark as correct if you find this suitable
Shashi Mogalgiddi 3Shashi Mogalgiddi 3
Hi All, along with the user name, I wanted the country from Users profile.  So I slightly modified the query to include Assignee Id and did a vlookup.  Thanks for the suggestion.
SisoSiso
SELECT Id, PermissionSetId, PermissionSet.Name, PermissionSet.ProfileId, PermissionSet.Profile.Name, AssigneeId, Assignee.Name FROM PermissionSetAssignment WHERE PermissionSet.Name = 'Custom PermissionSet Name'