You need to sign in to do that
Don't have an account?
daveleland
Apex Trigger to Populate a field on the account when the Account Owner changes
I'm trying to write my first trigger and having difficulties doing it. I was wondering if someone could help me.
On the account record there is a field called District__c. This needs to be the same as Territory__c on the account owner's user record. I would like the trigger to fire when the account owner is changed to keep the two fields in sync. The trigger would need to work also when accounts are mass transferred from one owner to the other.
Thank you in advance for your help!
Claire
Might be this helps you
Hi Claire,
You can try using the code snippet provided below which will work in the following scenarios:
I hope this helps. In case you have any questions, feel free to ask.
thank you both! I will try out these solutions today!
Claire
I've been working through the trigger trying to understand it and I think I'm just about there (this is my first trigger so I am a complete novice!) . Now I am trying to work out how to do the test class. Can you help me with that? Thank you so much!