This new ChangeOwner action provides advanced automation control over how related objects get handled when a records owner is changed.
Flow already makes short work of changing the owner of a record; a single Update Record is all it takes. But elsewhere in Salesforce, there’s support for more sophisticated ownership change control. For example, when you change the owner of a Case or an Opportunity, you get an additional choices and two related changes:
When you change the owner of an Account from a list view, you get a large number of choices:
Change Owner in Style is a Flow Action that gives you the full power of all of those Salesforce “Owner Change Options”. One of the best ways to see what you can do is to run the test flow that comes packaged with the action. Here’s the main screen:
Now, the screen above is somewhat artificial because it’s designed to show every possible option. In practice, you’ll usually know which object type you’re dealing with, and won’t need to expose all of the possibilities that the action supports. In many cases, you won’t need to expose any UI at all.
How It Works
You need to pass in at least one of:
- a record
- a record collection
- a recordId
Those are set here:
- You need to pass in a User Id to the newOwnerId input. You can use a Lookup component for this (see the video above)
- You need a Remote Site Setting (The Change Owner action calls a public Salesforce API endpoint so you need to allow your org to essentially call itself.)
Most of the rest of the inputs are boolean inputs that take either true or false, but a few take specific values
The definitive guide to what works is here.
Important Limitations and Considerations
Note that Send Email Notification, which shows up in the Change Owner modal dialogs in the LIghtning UI is not supported here, as it is not exposed in the API for unknown reasons. Use another action to generate an email if you need this capability.
“Also transfer Notes, Attachments and Google Docs” doesn’t seem to be working at the API level.
There are a couple of inputs where, if you want to set them to true, you need to also set some other input to true. Those are:
|TransferOtherOpenOpportunities||In order for this to work TransferOwnedOpenOpportunities must ALSO be true|
|TransferAllOwnedCases||In order for this to work TransferOwnedOpenCases must ALSO be true|
Using This Action Directly From Apex
All invocable actions, like the one demonstrated here, can now be invoked directly from Apex code, without requiring any flows, as of Winter ’23. Learn more.
This action constructs a SOAP call from within Apex, allowing access to properties that exist only in SOAP headers. This is the full list:
This approach can be used to create invocable actions for these other SOAP use cases.