kushal33

update opportunity when account updated

Sep 26th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. trigger CopyToOpportunity on Account (after insert, after update) {
  2. List<Opportunity> opportunityList = new List<Opportunity>();
  3. for(Account ac : Trigger.New) {
  4. for(Opportunity opp : [select Source__c from Opportunity where accountid = :ac.id]) {
  5. opp.Source__c = ac.Source__c;
  6. opportunityList.add(opp);
  7. }
  8. }
  9. update opportunityList;
  10. }
Add Comment
Please, Sign In to add comment