1

Under the hood, transferring a record is just updating the value of OwnerId. Transfer Record is necessary to do this through the layout.

But is it necessary for DML?

That is, if we run the following code:

public with sharing class TestClass {
    public static void mymethod(Id accId, Id newOwnerId) {
        update new Account(
            Id=accId,
            OwnerId=newOwnerId
        );
    }
}

What permissions will be required? Just Edit on Account? Or will Transfer be required as well? Does it depend on the value passed in for accId and newOwnerId? The sharing setting?

1

What permissions will be required?

Read, Edit.

Just Edit on Account?

As well as Read. I realize that you can't have Edit without Read, but it's technically required.

Or will Transfer be required as well?

Transfer provides additional transfer capabilities. Without it, they can still transfer records they own or that their subordinates own.

Does it depend on the value passed in for accId and newOwnerId?

Yes. You need to have Transfer/Full Control on a record in order to assign ownership. You can get this permission level by way of Modify All Data, by Ownership (you own the record), and by Role Hierarchy (one of your subordinates owns the record). If you enable User Sharing as well, newOwnerId must be a user they can see. In addition, newOwnerId must be a user that has Read Accounts or better; you cannot own a record if you cannot see that type of object.

The sharing setting?

No. You can't generically share the ability the transfer accounts. You need to either inherit the permission (owner or subordinate owner) or have a permission that ignores sharing (Modify All Data or Modify All Accounts).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.