using flows in system mode allows for alternative approaches to changing ownership

The standard sharing button and change owner button are great for hierarchical organizations, as the ‘power’ magically flows up the role hierarchy - so bigger fish higher up the role hierarchy can change owner / share records of all the little fish underneath them.

this is not so great when there is a high degree of collaboration within roles. in my case, each role represents a country office and country offices are collaborative entities. anyone in the country office should be empowered to change the owner of a contact owned by anyone else in the office, without asking the current owner.

while the standard ‘change owner’ functionality is carved in stone cannot be overridden, you can add a custom button and a flow in system mode that allows for alternative models like this.

its quite simple. the flow runs in system mode. it checks if $user.role = owner.role, and if so, lets them proceed to a screen where they can select the new owner. if they are not in the same role, then it shows them a friendly error screen.

we added a few additional scenarios to allow changing owner if the current owner is inactive, or if the user has a custom permission.

there is no way to override or hide the standard change owner button, but there is an idea for that

you may be able to get crafty with flow formulas or apex to try to replicate the native power-flows-up-the-role-hierarchy magic, but you may run into issues there. we dont need that, its really more of a headache than a feature for us, so i have not tried.

here is a screenshot of the overall flow. if you have any questions hit me on the twitter and i can try to answer them



Now read this

Creating a Global Picklist with custom API values

Global picklists are great. As is the ability to customize the API names separately from the label. But while you can create picklist values via copy/paste, you have to update the API values individually. For small picklists its not that... Continue →