+ Start a Discussion
Priyesh Misquith 12Priyesh Misquith 12 

filtering user from multiple permission set.

I need to Query a user in Apex class.
Consider the user having permission set Permission1, Permission2 , Permission3

The permission1 has all the fields in Object ABC readonly but has Modify All access since user need access for notes and Attachment.(By modify all user also get Delete Access)

Need to Ristrict the user from the deleting Object if Only Permission1 assigned.
Pemission2 and Permission3 gives modify access to the ABC and when assigned to user along with permission1 the error should not be thrown.
each permission set have different purpose but i need to restrict user from deleting the record only when Permission1  is assigned.

could you help me how can i filter this user using Query on permissionset Object using permission set name.

Ashima nidhiAshima nidhi
To fetch the information regarding permission set. Please check the below URL :

SELECT Id, PermissionSetId, PermissionSet.Name, PermissionSet.ProfileId, PermissionSet.Profile.Name, AssigneeId, Assignee.Name FROM PermissionSetAssignment WHERE Assignee.Name = 'JOHN SMITH'

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.