I am trying to create a validation rule for Account. I want to limit the capability of the user to transfer the accounts (or changing de ownerID of the Account) . I only want them to be able to transfer Accounts to users that have the same role.
I am not being able to create the validation rule, this is sample of what I did but it is not working.
AND(
ISCHANGED( OwnerId ),
VLOOKUP($User.UserRole.name,$User.Id,PRIORVALUE(OwnerID)) = $UserRole.name
)
Thanks in advance for any tips.