soql on object permissions on a profile
Clash 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
soql permissions crud
 |Â
show 2 more comments
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
soql permissions crud
Maybe there are two permission set and both having permission on account object.
– Pragati Jain
1 hour ago
I am having the same. prefix110
indicates, that it isObjectPermissions
sobject. But prefix000
is not recognized. Interesting
– Oleksandr Berehovskiy
1 hour ago
I used the following code to get API name of sobject related toId
: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
 |Â
show 2 more comments
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
soql permissions crud
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
soql permissions crud
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. prefix110
indicates, that it isObjectPermissions
sobject. But prefix000
is not recognized. Interesting
– Oleksandr Berehovskiy
1 hour ago
I used the following code to get API name of sobject related toId
: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
 |Â
show 2 more comments
Maybe there are two permission set and both having permission on account object.
– Pragati Jain
1 hour ago
I am having the same. prefix110
indicates, that it isObjectPermissions
sobject. But prefix000
is not recognized. Interesting
– Oleksandr Berehovskiy
1 hour ago
I used the following code to get API name of sobject related toId
: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
 |Â
show 2 more comments
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);
Got it! As of now I can proceed with this solution.
– Sagnik
9 mins ago
add a comment |Â
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);
Got it! As of now I can proceed with this solution.
– Sagnik
9 mins ago
add a comment |Â
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);
Got it! As of now I can proceed with this solution.
– Sagnik
9 mins ago
add a comment |Â
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);
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);
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
add a comment |Â
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
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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 isObjectPermissions
sobject. But prefix000
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