I was trying to find out CRUD level permissions for a particular object on a specific profile for which I've framed below query:

SELECT Id,SObjectType,PermissionsRead,PermissionsCreate FROM ObjectPermissions where SObjectType = 'Account' and parentid in (select id from permissionset where PermissionSet.Profile.Name='System Administrator').

Now this is returning following result:

 Id                 SobjectType     PermissionsRead PermissionsCreate
 00000000lspT001AAC Account         TRUE            TRUE
 1104100000GpahYAAR Account         TRUE            TRUE

What is confusing me is that there are two results however it should have been only one . Can someone explain why we see two results

  • Maybe there are two permission set and both having permission on account object. – Pragati Jain Oct 25 '18 at 7:28
  • I am having the same. prefix 110 indicates, that it is ObjectPermissions sobject. But prefix 000 is not recognized. Interesting – Oleksandr Berehovskyi Oct 25 '18 at 7:42
  • I used the following code to get API name of sobject related to Id: Id someId = Id.valueOf('1105000000AN85gAAD'); String sobjectName = someId.getSobjectType().getDescribe().getName(); System.debug('sobjectName: ' + sobjectName); – Oleksandr Berehovskyi Oct 25 '18 at 7:44
  • This is a problem. Specifically when I've given profile name as Sys Admin ideally it should have returned one result . – Sagnik Oct 25 '18 at 7:52
  • @Sagnik do you have to make this SOQL in apex ? if so, I have workaround for you – Oleksandr Berehovskyi Oct 25 '18 at 7:54

according to Standard Field Record ID Prefix Decoder I found few words about X00 Id prefix:

Found in the PermissionSet Name column where the ProfileId is also defined. It matches the ProfileId with the exception of the key prefix.

I'm not sure for what is it used. Looks like it is related to this situation. Waiting for other thoughts.

Workaround for you is to filter only needed ObjectPermissions ids. They are started with 110:

List<ObjectPermissions> objPermissions = [
    select Id, SObjectType, PermissionsRead, PermissionsCreate
    from ObjectPermissions
    where SObjectType = 'Account'
        and ParentId in (
            select id
            from PermissionSet
            where PermissionSet.Profile.Name='System Administrator'
                and PermissionSet.IsOwnedByProfile = true
List<ObjectPermissions> sanitizedObjPermissions = new List<ObjectPermissions>();
for(ObjectPermissions objPermission :objPermissions){
    String someId = String.valueOf(objPermission.Id);
System.debug('sanitizedObjPermissions: ' + sanitizedObjPermissions);
  • Got it! As of now I can proceed with this solution. – Sagnik Oct 25 '18 at 8:34

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.