SHARE
TWEET

Untitled

a guest Aug 12th, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. trigger AUTOADDPRODUCT on OpportunityLineItem (after insert) {
  2.     List<OpportunityLineItem> OpportunityLineItems = new List<OpportunityLineItem>();
  3.     for (OpportunityLineItem newOpportunityLineItems: Trigger.New) {
  4.         if(newOpportunityLineItems.Name == 'CarOIL'){
  5.             OpportunityLineItems.add(new OpportunityLineItem(PricebookEntryId ='ID CODE FOR CarOILplus',Quantity = 1,UnitPrice = 25));
  6.         }
  7.     }
  8.     if(!OpportunityLineItems.isEmpty()){
  9.         insert OpportunityLineItems;
  10.     }
  11. }
RAW Paste Data
Top