2

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 :)

8

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 '14 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 '15 at 4:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.