[SalesForce] Process Builder does not fire when account owner is changed which causes opportunity owner to change

I am trying to create a process builder that fires as follows:
Account owner is changed (standard functionality then changes the opportunity owner to = the account owner). When the resulting opportunity owner changes I want to create a record for object C.
I currently have a process builder that fires correctly (creates record for Object c) when directly changing the opportunity owner.

Best Answer

So to fix this on owner changes that come from the Account level, since workflows and processes won't fire off this owner change, we can make a headless flow that we can then execute as the action when Account owner changes.

Lets start by creating the flow. When you create it, be sure to select it as an Autolaunched Flow, which means it requires no user interaction and can be called from a Process.

enter image description here

Next, we will need to setup a few input variables that will be used to both locate opportunities linked to the account, as well as the new Account Owner ID that we wish to assign to the newly created Object C.

enter image description here

enter image description here

Our first step (and start step) in the flow will be to lookup Opportunities that are linked to the Account ID. Assign the return value to a new Sobject Collection Variable.

enter image description here

After we have the Opportunities, we will loop through them with a new Loop step. We will loop through the LinkedOpportunities and assign a new Loop Sobject Variable. You only need the Id field to be returned.

enter image description here

For every "opp" in the collection, we want to create a new record. Here is where we will define anything that we want to set on our Object C record we are creating. Here is where we will set the OwnerId of the new Object C to the accountownerid and set the opportunity to be the current opp.id we are at in the loop. This creates your object C for every opportunity linked to the source account and sets the ownerid to the account ownerid. Save and activate the flow.

enter image description here

Now we just need to create a Process on Account that will fire this flow. Use the same logic you are using on your opportunity process to fire off on account owner change, only instead of trying to create an object c record, select Flow as your action and then select the Flow you just created.

enter image description here

After all this, you should be good to go. This will fire off anytime the account owner changes, and will create object C's for every opportunity linked to that account, link it to the opportunity, and set the owner as the new account owner. Let me know if this doesn't work for you.

enter image description here

Related Topic