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
Greg HGreg H 

Account Trigger Fires Partially When Owner Is Changed in UI

I wrote a trigger to fire on the Account object after the record is updated. At a high level I want the trigger to reassign Contacts and Opportunities to the new Account Owner but only when a specific User makes the update.

 

Upon testing in the user interface, I found that the trigger fires when a User reassigns an Account using the "[Change]" link on the Account detail page even when the User is not the one specified in the trigger.

 

Am I missing something about how an Account trigger works regarding OwnerId updates?

-greg

flomadflomad

Hey Greg,

 

Since it is an update trigger I guess you just use the wrong field for your purpose. It seems to me you are using the OwnerID but you want to use the LastModyfiedby Field.

 

Owner is the one who created the record but you want to react on the user that reassigns the record.

 

Hope it helps. If not just paste in your code and I am sure we can find a solution to this.

 

-Florian

Greg HGreg H

I forgot that the UI already handles reassignment of Account related Contacts and Open Opportunities when the Owner is changed on a given account. I was under the impression that the trigger I wrote was processing only a portion of the code, which is absurd. It turns out that the trigger is not firing in the scenario I explained - it is the system that is making the reassignments... Everything is working as intended
-greg

Message Edited by Greg H on 12-08-2009 11:08 AM