soql on object permissions on a profile

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
1
down vote

favorite












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










share|improve this question





















  • Maybe there are two permission set and both having permission on account object.
    – Pragati Jain
    1 hour ago










  • I am having the same. prefix 110 indicates, that it is ObjectPermissions sobject. But prefix 000 is not recognized. Interesting
    – Oleksandr Berehovskiy
    1 hour ago










  • 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 Berehovskiy
    59 mins ago










  • This is a problem. Specifically when I've given profile name as Sys Admin ideally it should have returned one result .
    – Sagnik
    51 mins ago










  • @Sagnik do you have to make this SOQL in apex ? if so, I have workaround for you
    – Oleksandr Berehovskiy
    48 mins ago
















up vote
1
down vote

favorite












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










share|improve this question





















  • Maybe there are two permission set and both having permission on account object.
    – Pragati Jain
    1 hour ago










  • I am having the same. prefix 110 indicates, that it is ObjectPermissions sobject. But prefix 000 is not recognized. Interesting
    – Oleksandr Berehovskiy
    1 hour ago










  • 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 Berehovskiy
    59 mins ago










  • This is a problem. Specifically when I've given profile name as Sys Admin ideally it should have returned one result .
    – Sagnik
    51 mins ago










  • @Sagnik do you have to make this SOQL in apex ? if so, I have workaround for you
    – Oleksandr Berehovskiy
    48 mins ago












up vote
1
down vote

favorite









up vote
1
down vote

favorite











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










share|improve this question













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







soql permissions crud






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 1 hour ago









Sagnik

128215




128215











  • Maybe there are two permission set and both having permission on account object.
    – Pragati Jain
    1 hour ago










  • I am having the same. prefix 110 indicates, that it is ObjectPermissions sobject. But prefix 000 is not recognized. Interesting
    – Oleksandr Berehovskiy
    1 hour ago










  • 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 Berehovskiy
    59 mins ago










  • This is a problem. Specifically when I've given profile name as Sys Admin ideally it should have returned one result .
    – Sagnik
    51 mins ago










  • @Sagnik do you have to make this SOQL in apex ? if so, I have workaround for you
    – Oleksandr Berehovskiy
    48 mins ago
















  • Maybe there are two permission set and both having permission on account object.
    – Pragati Jain
    1 hour ago










  • I am having the same. prefix 110 indicates, that it is ObjectPermissions sobject. But prefix 000 is not recognized. Interesting
    – Oleksandr Berehovskiy
    1 hour ago










  • 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 Berehovskiy
    59 mins ago










  • This is a problem. Specifically when I've given profile name as Sys Admin ideally it should have returned one result .
    – Sagnik
    51 mins ago










  • @Sagnik do you have to make this SOQL in apex ? if so, I have workaround for you
    – Oleksandr Berehovskiy
    48 mins ago















Maybe there are two permission set and both having permission on account object.
– Pragati Jain
1 hour ago




Maybe there are two permission set and both having permission on account object.
– Pragati Jain
1 hour ago












I am having the same. prefix 110 indicates, that it is ObjectPermissions sobject. But prefix 000 is not recognized. Interesting
– Oleksandr Berehovskiy
1 hour ago




I am having the same. prefix 110 indicates, that it is ObjectPermissions sobject. But prefix 000 is not recognized. Interesting
– Oleksandr Berehovskiy
1 hour ago












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 Berehovskiy
59 mins ago




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 Berehovskiy
59 mins ago












This is a problem. Specifically when I've given profile name as Sys Admin ideally it should have returned one result .
– Sagnik
51 mins ago




This is a problem. Specifically when I've given profile name as Sys Admin ideally it should have returned one result .
– Sagnik
51 mins ago












@Sagnik do you have to make this SOQL in apex ? if so, I have workaround for you
– Oleksandr Berehovskiy
48 mins ago




@Sagnik do you have to make this SOQL in apex ? if so, I have workaround for you
– Oleksandr Berehovskiy
48 mins ago










1 Answer
1






active

oldest

votes

















up vote
2
down vote













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);
if(someId.startsWith('110'))
sanitizedObjPermissions.add(objPermission);


System.debug('sanitizedObjPermissions: ' + sanitizedObjPermissions);





share|improve this answer






















  • Got it! As of now I can proceed with this solution.
    – Sagnik
    9 mins ago










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "459"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f237238%2fsoql-on-object-permissions-on-a-profile%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
2
down vote













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);
if(someId.startsWith('110'))
sanitizedObjPermissions.add(objPermission);


System.debug('sanitizedObjPermissions: ' + sanitizedObjPermissions);





share|improve this answer






















  • Got it! As of now I can proceed with this solution.
    – Sagnik
    9 mins ago














up vote
2
down vote













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);
if(someId.startsWith('110'))
sanitizedObjPermissions.add(objPermission);


System.debug('sanitizedObjPermissions: ' + sanitizedObjPermissions);





share|improve this answer






















  • Got it! As of now I can proceed with this solution.
    – Sagnik
    9 mins ago












up vote
2
down vote










up vote
2
down vote









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);
if(someId.startsWith('110'))
sanitizedObjPermissions.add(objPermission);


System.debug('sanitizedObjPermissions: ' + sanitizedObjPermissions);





share|improve this answer














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);
if(someId.startsWith('110'))
sanitizedObjPermissions.add(objPermission);


System.debug('sanitizedObjPermissions: ' + sanitizedObjPermissions);






share|improve this answer














share|improve this answer



share|improve this answer








edited 3 mins ago

























answered 20 mins ago









Oleksandr Berehovskiy

7,80521735




7,80521735











  • Got it! As of now I can proceed with this solution.
    – Sagnik
    9 mins ago
















  • Got it! As of now I can proceed with this solution.
    – Sagnik
    9 mins ago















Got it! As of now I can proceed with this solution.
– Sagnik
9 mins ago




Got it! As of now I can proceed with this solution.
– Sagnik
9 mins ago

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f237238%2fsoql-on-object-permissions-on-a-profile%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

List of Gilmore Girls characters

What does second last employer means? [closed]

One-line joke