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
but
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.