You need to sign in to do that
Don't have an account?
Ram Chaturvedi
How can i change ownership of any custom object record , by using apex code ?
I want to change ownership of any record to the another user so if i am trying to change "owner.id" it gives error not writable .
As Karanraj said, you will have to update the OwnerID field and not Owner.Id.
Owner.Id will select the Owner user and try to update its Salesforce ID, which is always Read-Only.