+ Start a Discussion

Trigger to keep open opportunity owner unchanged



Can someone share their code on how to keep the open opportunity owner after the account owner is changed? 


you can always retrieve the old value (the value of a field before a trigger executed) via the trigger.oldMap collection and then compare the new value against the old to determine if you want to do something in your trigger.


Check out the following docs:




In your case however, it may be easier to just make the field read-only for most profiles, or remove it from the page layout.