You need to sign in to do that
Don't have an account?
Trigger Help
Trying to set a custom sales region field with the owner's sales region defined in the user object. I was hoping to use the formula field to do this but apparently I can't link the Owner from Opportunity to the User object there. Here is what I have so far and I know I am way off. Any help is appreciated.
trigger myAccountTrigger on Account (after insert, after update) {
if (Trigger.isInsert) {
//
}
if (Trigger.isUpdate) {
for(Opportunity o: Trigger.new){
region = [select User.Sales_Region_c from User where User.ID = OwnerID]
Sales_Region__c = region
}
}
Sorry about the confusion. It is on the Opportunity object. I copied and pasted the first draft instead of the edited version, not much different than where I was stuck except I was going against the Opportunity and not Account. I would like to replace the field with the User object Sales Region when a new Opportunity is created or it is edited. I will most likely apply this to the Account object as well so maybe that could be in the same trigger. Thanks for the help.
Awesome, thanks for the help. I'll try it out over the next couple days.