function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nishanth99Nishanth99 

Transfer Requires Read

Hi All,

 

on custom object i had all permissions(read/create/delete), even in test methods i am facing the below problem

 

System.DmlException: Insert failed. First exception on row 0; first error: TRANSFER_REQUIRES_READ, The new owner must have read permission

 

is this because of writing "for update" in the queries?

 

please help me  asap, its urgent.

 

Thanks

saleem

Best Answer chosen by Admin (Salesforce Developers) 
Rahul_sgRahul_sg
Are you using with sharing keyword in your apex class... Few users might not have sufficient permissions.
Try using RunAs in you test method with System admin running the test or remove with sharing for testing purpose and then fix the code accordingly

All Answers

Rahul_sgRahul_sg
Are you using with sharing keyword in your apex class... Few users might not have sufficient permissions.
Try using RunAs in you test method with System admin running the test or remove with sharing for testing purpose and then fix the code accordingly
This was selected as the best answer
sfdcfoxsfdcfox
It appears that you are setting OwnerId (or some trigger somewhere is...) that is assigning the record to an illegal owner, one without read permission on the object. You'll probably need to use your debug logs to figure out where this action is occurring.