• Bernie_in_Tucson
  • 0 Points
  • Member since 2010

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 1

I am very new to salesforce, and even newer to Apex.  I'm trying to update a field on my account object, after an opportunity has been closed - won. Here is my first attempt;


trigger AccountTypeUpdate on Opportunity (after update) {
    Account myAccount=trigger.update[0];
    if (opportunity.StageName = 'A - Closed Won') {
     myAccount.type = 'Customer';
     update myAccount;
    }    //else nothing


Evidently it doesn't work, and I realize I would have to select the account associated with that opportunity, I'm just not sure how to go about doing that.  Any help would be greatly appreciated.