I have a custom button on my accounts list view to change the record from the current owner to my ownership using OnClick Javascript. I have admin privileges and when I use the button it succeeds in changing the ownership to me. However, when I try to change the ownership as another user the record does not change ownership. I have ensured that the profiles of the users attempting to make the change have the system permission to change the record owner or transfer records. Any help is appreciated. The code used was as follows:
{!REQUIRESCRIPT('/soap/ajax/31.0/connection.js')}
var accountIds = {!GETRECORDIDS($ObjectType.Account)};
var account = [], tempAccount, result;
while(accountIds.length) {
tempAccount = new sforce.SObject('Account');
tempAccount.Id = accountIds.shift();
tempAccount.OwnerId = '{!$User.Id}';
account.push(tempAccount);
}
result = sforce.connection.update(account);
window.top.location.href = window.top.location.href;