Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. for(Opportunity i : opProduct){
  2.  
  3. pid.add(i.AccountId);
  4. }
  5. List<PriceBookEntry> priceBookList = [SELECT Id, Product2Id,Product2.Name FROM PriceBookEntry where Product2Id=:sub.OrderApi__Item__r.FS_Product__c];
  6.  
  7. list<Opportunity> opo = [select id,name,closedate,AccountId,Pricebook2Id,StageName from Opportunity where AccountId in : pid];
  8.  
  9. for(Opportunity pro : opo){
  10.  
  11. if(pro.AccountId!=null){
  12.  
  13. OpportunityLineItem l = new OpportunityLineItem(OpportunityId=pro.id,Quantity=1,UnitPrice=10,PricebookEntryId=priceBookList[0].Id,ServiceDate=system.today());
  14. li.add(l);
  15. }
  16.  
  17. }
  18. }
  19. insert li;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement