function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tobias Toal - activeTobias Toal - active 

Opportunity-Owner does not change when Account-Owner is changed

Hi guys,

I thought, that by default, when an Account Owner is changed, open Opportunities owned by said User are given to the new Account Owner as well.
I know that this is the default when Account Owner is changed via front end. I thought this was the default for Account Owner changes via Apex Trigger as well? Is it not?
We have a Trigger that changes the Account Owner. However, the open Opportunities that are owned by the old Account Owner, don't get transferred to the new Account Owner.
Any idea why? Or do we have to put that Opportunity-Owner change into the Apex explicitly?

Thanks and best regards
Toby

P.S.: I know that Opps don't get transfered when Account-Owner is changed via API. The API Version 35 (Winter16) offers new "OwnerChangeOption" for that though. Is there something equivalent in Apex Classes?
Best Answer chosen by Tobias Toal - active
Shashikant SharmaShashikant Sharma
Yes, you have to change oppotunity owner from Apex Trigger Code. You could write a Apex Triger on account that when ever account owner is change find all oportunities and change owner.

Thanks
Shashikant

All Answers

Shashikant SharmaShashikant Sharma
Yes, you have to change oppotunity owner from Apex Trigger Code. You could write a Apex Triger on account that when ever account owner is change find all oportunities and change owner.

Thanks
Shashikant
This was selected as the best answer
Tobias Toal - activeTobias Toal - active
Hi Sashikant,
thanks for your reply (unfortunate for us because we didn't know and thus didn't implement, but good to know now).
Best regards
Toby
Neil Bradbury 1Neil Bradbury 1
The solution to this does not require APEX.
1. Create a Process on the Opportunity object
2. Use a condition to update the Opportunity when the Opportunity. OwnerID ISCHANGED AND Opportunity > Account.OwnerID ISCHANGED
3. Update the Opportunity.OwnerID using PRIORVALUE
Harish NallalaHarish Nallala
Hi Neil & Tobias,

Is it works,I want to update opp team member with Opp.Owner as a team lead,when Account owner is changed followed by opportunity owner.

I have tried ,but it doesnt create Opp team, any ideas?

Thank you In advance,

Harish.
Tobias Toal - activeTobias Toal - active
Hi Harish,
do I understand correctly: Your Account Owner is changed, that changes the Opportunity Owner, and you want to add the previus Opportunity Owner or the new Opportunity Owner as Opportunity Team Member??
Best regards
Toby
Harish NallalaHarish Nallala
Hi Tobias,

Thanks for your Prompt Response.Yes it is,It doesn't trigger,when the Account owner is changed.

when Account owner is changed,defaultly related Opp owner changes,but the new Opportunity owner doesn't add to the Opportunity team as a team lead.

I tried Process builder and a trigger,but it works only on opportunity Object,not to fire from Account Object.Any Ideas?

Thanks,

Harish.
Haneef SHaneef S
hi Harish,

Could you please share , how did you achieve aboce scenario.
Thanks in advance!
Haneef