Does anyone know a basic way that I can run a SOQL query to see which permission sets are attached to users?

We have a rather large issue where a button needs to be on a page layout for a few important users but the rest of the people on the profile should not have visibility or use of this.

I have pushed the idea to have a new profile, but my company is rather large and wont allow it... so I was going to use .js in a button to show the button to the users whom should be able to see it and hide hide it for those who should not be able to see it..

Other ideas are welcome :)

1 Answer 1


How PermissionSet relates to User is illustrated in this User, Sharing, and Permission Objects ERD.

So for example, this SOQL will list all permission set assignments:

select Assignee.Name, PermissionSet.Name
from PermissionSetAssignment
order by Assignee.Name, PermissionSet.Name

and this will list permission sets for a specific user:

select PermissionSet.Name
from PermissionSetAssignment
where Assignee.Id = :userId
order by PermissionSet.Name

You may wish to add further filtering.

  • That's PERFECT!
    – Tim
    Apr 2, 2014 at 17:17
  • For some reason the above query is not working in my Sandbox. Any idea? Developer console gives this message "sObject type 'PermissionSetAssignment' is not supported." Thanks
    – Hari
    Apr 30, 2015 at 4:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .