How can I get in my service class(Apex class) that a logged in user is having view all and modify all permissions on any particular object.

  • i want to see how to identify if user has modify all/view all permission from code Feb 23, 2015 at 13:22
  • Can you give a bit more context to the question, i.e. what is the use case. Also, have you looked into the with sharing and without sharing keywords. If not, check it out here salesforce.com/us/developer/docs/apexcode/Content/… Feb 23, 2015 at 17:43

1 Answer 1


You can query the permissionsetassignment object to determine if a user has PermissionsViewAllData or PermissionsModifyAllData (I believe, check the documentation). See https://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_permissionsetassignment.htm for more information.

Edit: You can also query for specific objects. The items mentioned above are the global permissions.

  • Can we query ObjectPermissions object instead? May 28, 2020 at 14:28
  • 1
    @rahulgawale if you want the permissions for a specific object, yes.
    – sfdcfox
    May 28, 2020 at 15:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .