0

I am unable to figure out the relation between the objects. I want to extract modifyall permission for all the available user profiles for all objects(standard and custom). I tried using the query

 SELECT Assignee.Name, PermissionSet.Id,
 PermissionSet.isOwnedByProfile, PermissionSet.Profile.Name,
 PermissionSet.Label FROM PermissionSetAssignment WHERE PermissionSetId
 IN (SELECT ParentId FROM ObjectPermissions WHERE SObjectType =
 'Account' AND PermissionsRead = true)

But it is unable to fulfill the criteria. Also the above query does not return the profile name insted it is returning [object Object] for the column PermissionSet.Profile.Name in the query

Kindly suggest if there is any other Kindly suggest if there is any other way to solve this problem!

Or if we can write a query to extract table with fields like :
Profile Name sObject PermissionRead PermissionModifyAllRecords etc.

Thankyou

0

When you go for more than 2 level it will display as [object.object] than its value in developer console query.

If you are interested only on profile then try the below,

SELECT Profile.Name from PermissionSet  WHERE Id
 IN (SELECT ParentId FROM ObjectPermissions WHERE SObjectType = 'Account' AND PermissionsRead = true)
  • i already tried working with this. This works perfect, but i have to execute query separately for every sObject. Is it possible to get permission for all sObjects? – Saumya Gaikwad Jun 1 '17 at 4:25
1

I think it might help you.

List<PermissionSetAssignment> lst = [SELECT Assignee.Name, PermissionSet.Id, PermissionSet.isOwnedByProfile, PermissionSet.Profile.Name, PermissionSet.Profile.Id,
 PermissionSet.Label, PermissionSet.Name 
 FROM PermissionSetAssignment WHERE PermissionSetId 
 IN (SELECT ParentId FROM ObjectPermissions WHERE PermissionsRead = true)];

System.debug(JSON.serialize(lst));
  • It does not fulfill the criteria. i want permission corresponding to sObject, not Assignee.Name – Saumya Gaikwad Jun 1 '17 at 6:50

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.