I am not sure why OpportunityShare object and UserRecordAccess objects are giving different access level for a particular record and user combination.

If i run following query on UserRecordAccess object and try to extract HasEditAccess field it return FALSE.

SELECT RecordId, HasEditAccess FROM UserRecordAccess WHERE UserId ='00570000001pGWABA2' AND RecordId ='006Q000000Bt1eMIBR' // Returns false


If i run follwoing query on OpportunityShare object it returns Edit access.

select OpportunityAccessLevel from OpportunityShare WHERE UserOrGroupId ='00570000001pGWABA2' AND OpportunityId ='006Q000000Bt1eMIBR' // Edit

I am not sure why both queries returning different results?

If i have shared an opportunity with some other user using Apex and grant him Edit right then UserRecordAccess object must return True for that particular user and opportunity combination.

2 Answers 2


I think you're confusing object-level and record-level permissions. Profiles and permission sets determine how a user can interact with an object, such as Leads, Accounts, and Opportunities. Unless you set View All/Modify All for an object that user may or may not have access to individual records.

Sharing rules modify which records a user can see and edit, providing the user's profile allows for such actions. I can share Opportunities with a user, but if that user's profile does not provide at least Read access to Opportunities that user will never see those records.


UserRecordAccess tells you what access the user has to a particular record; this is the culmination of all of the security settings, starting with the user's profile and assigned permission sets and then applying your global security settings and sharing rules.

If a user is not assigned a profile or permission set granting Edit to the object then UserRecordAccess will always be false since the user does not have access to edit that object.

  • you mean UserRecordAccess object shows record access permissions as per your profile permission on that object? Sep 17, 2013 at 17:19
  • Please see my update for an explanation.
    – Mike Chale
    Sep 17, 2013 at 17:23
  • Very nice. Now every thing is clear to me. Thanks a lot @Mike Sep 17, 2013 at 17:26

Can it be that the profile restricts edit on Opportunities ? I don't know how Apex manual sharing handles this...


You must log in to answer this question.

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