You need to sign in to do that
Don't have an account?

Validation Rule to prevent transfer records outside of role
I have a requirement to create a validation rule to prevent transferring of records outside of a role. I would like to allow users of a role to transfer objects owned by users in their role. Any users outside of their role would not have permission to transfer records.
Currently, our security is set to private and we enable view access to all accounts,leads,opportunity objects. We have in place sharing rules per object per role, that give access to users within their respective role to edit those objects. People outside that immediate role, do not have access to edit those objects.
The solution provides this :
Mary in Role A
Joe in Role A
Bob in Role B
Mary can transfer an account that Joe owns into her name, but cannot transfer an account that Bob owns. Bob cannot transfer Mary or Joe's account into his name.
Is there a formula to use for a validation rule to only allow transferring objects based on roles as described in the example above?
Thanks!
Currently, our security is set to private and we enable view access to all accounts,leads,opportunity objects. We have in place sharing rules per object per role, that give access to users within their respective role to edit those objects. People outside that immediate role, do not have access to edit those objects.
The solution provides this :
Mary in Role A
Joe in Role A
Bob in Role B
Mary can transfer an account that Joe owns into her name, but cannot transfer an account that Bob owns. Bob cannot transfer Mary or Joe's account into his name.
Is there a formula to use for a validation rule to only allow transferring objects based on roles as described in the example above?
Thanks!
All Answers
Noticed the formular below is checking on the current users and not the Account owner. So if the manager of that user (RoleA) (who belong in another role) want to transfer to another user in RoleA then he/she may get an error. In that case you may want to improve your formula to ignore when users in specific roles are making the changes.
There is a long and correct way for manager case above if you want to even only allow the managers to transfer account to user with the same Role as the current account owner.
That validation rule still allows Mary in Role A to transfer Bob's account (in Role B) into Mary's name.
Once that account is in Mary's name, she can transfer to Joe but cannot transfer out of her role.
How do we add in the clause - do not allow Mary to transfer Bob's accounts into her own name?
Thanks
In this case, then you may have to use a trigger to accomplish this. Validation has an option to get the PreviousValue but for related object. IE, it only get the previous ID of the related objec, in this case previous owner ID. However, we can't get the Previous Owner RoleID with validation formula.
So the short answer is we can't use Validation rule to accomplish this unless we use a trigger to update a custom field of the previous owner Role and use that field in your validation rule. Or to save you a validation rule to manage, simple throw the error within the trigger when previous user Role != current user role.
Hope this helps.
In terms of building out this trigger, would it b a complex trigger or somethig a developer could write in a few hours? Just trying to understand the scope a little better
thank you again!