You need to sign in to do that
Don't have an account?
CCCBBBAAA
How do I grant a user read permission on a record from Apex?
I receive an error "TRANSFER_REQUIRES_READ" if I try to change the OwnerId of a custom object in my unit tests. I have tried setting the role of the user in question (within the unit test) to our "System Administrator" role, but this yields nothing, I still get the same error. I've also attempted to create a UserRecordAccess object in the test with UserId set to this user, HasReadAccess set to `true', and RecordId set to the custom object, but Salesforce rejects this as well, returning an error stating that UserId field is read-only on UserRecordAccess objects.
i.e. Setup > Administration Setup > Manage Users > Profile >
Check the Object access settings for the User's profile you are using in your test method.
Cheers!