I need to check if a permission is enabled among assigned permission sets of Logged in User.

Lets say I have 3 permission sets named as PSet1, PSet2 and PSet3 assigned to a User. Need to find out if 'Manage External Users' permission is set as true among these three permission sets.

Can you please guide me the way to achieve this.


If it's just a one-off, you can:

Boolean canManageExternalUsers = [
    FROM PermissionSetAssignment
    WHERE AssigneeId = :UserInfo.getUserId()
    AND PermissionSet.PermissionsManagePartners = TRUE
] > 0;

If you need this in bulk, you'd have to optimize this to return the individual values and fields, and then loop through the results to determine which users have this permission.

  • I will try that and let you know.
    – Avijit
    Dec 7 '19 at 2:21

Although you asked for an apex solution, here's a handy (free) Permission Set Helper app from SFDC Labs that can find users with a given permission using a UI. Note: LEX only

enter image description here

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.