April 15, 2015

Salesforce: check if user has assigned permission set

Code to check if user has assigned permission set

1
2
3
4
5
6
7
8
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;
}

Tags



Share


Recent Articles

It’s all about Quality: Migration and Data Validation Testing

June 14, 2019 | Yuliya Zubenko, Senior QA Engineer

There exists a lot of reasons why organizations are forced to migrate their data. Data migration can be performed manually or by using special tools. The process becomes more challenging if the migration is to be performed for a complex application with huge amount of data. Data Accuracy is a key aspect that should be […]

Hot and Trendy: Google Teams up with Looker

June 10, 2019

The IT world is stirred up with the latest plans of Google to acquire Looker, a data analytics platform. Google LLC announced its agreement with Looker to join forces in the development of a comprehensive data analytics solution for customers.   Looker, a business analytics and data intelligence platform, empowers organizations to draw insights from […]

Contact Us

By submitting this form you acknowledge that you agreed to our Cookies and Privacy Policy.