You need to sign in to do that
Don't have an account?
Gaurav Agnihotri
Trigger on Quotes to Update Opportunity AccountId
I have created a new Account Lookup field in Quotes. As soon as a user chooses that Account from Account Lookup, it should update AccountId on Opportunity with that lookup account. I created a trigger, but it does not seem to work.
trigger updateOpptyAccount on Quote (before insert,before update) { for (Quote QuoteInLoop : Trigger.new){ Boolean sMainAccount=QuoteInLoop.Main_Account__c; String sQuoteAccountId=QuoteInLoop.Pelco_Account_Name__c; String sOptyId=QuoteInLoop.OpportunityId; if(sMainAccount ){ //QuoteInLoop.AccountId=sQuoteAccountId; List <Opportunity> Oppty1=[SELECT AccountId from Opportunity where Id = :sOptyId]; Oppty1[0].AccountId=sQuoteAccountId; } } }I am a newbie, would appreciate any help/suggestion.
Kindly refer below code:
Regards
Mohit Bansal
Note: Please mark it as a "Best Answer", if helps you in resolving your query.
All Answers
Kindly refer below code:
Regards
Mohit Bansal
Note: Please mark it as a "Best Answer", if helps you in resolving your query.