Salesforce: check if user has assigned permission set

April 15, 2015

Code to check if user has assigned permission set

static public Boolean checkIfUserHasAssignedPermissionSet(String userName, String permissionSetName) {
    List<PermissionSetAssignment> psas = [ select Id from PermissionSetAssignment where PermissionSetId IN ( select Id from PermissionSet where Name = :permissionSetName) and AssigneeId IN (select Id from User where UserName = :userName ) ];
    return psas.size() > 0;



0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Articles

9 Big Things about Java 9

September 15, 2017 | Andrew Petryk

According to the latest Tiobe index of programming language popularity, Java tops the list.  No wonder there is so much buzz around the new Java 9 release, set for September 21, 2017.  Take a walk through with our expert.     1. JSHELL Many compiled languages include tools for statements interpretation. By using these REPL tools […]

What are your customers telling you? Maximize the effectiveness of sentiment analysis by using simple tips

September 7, 2017 | Lily Smirnova

Sentiment analysis is one method to gather and process customer-supplied information, and then convert it to a quality customer experience. Gartner predicts that 85% of all businesses will compete in the area of customer experience by 2020. As sentiment analysis explodes onto the scene, what can technology actually do to enhance business efforts? Hints on […]