daily pastebin goal
67%
SHARE
TWEET

Untitled

a guest Dec 13th, 2018 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Product      Qunatity       Price
  2.  
  3. pen           2            10
  4.  
  5. pen           3            9
  6.    
  7. List<Quote_Item__c> qilist = new List<Quote_Item__c>();
  8.    for(QuoteLineWrapper wrapper : req.qlines){      
  9.   Quote_Item__c qi = new Quote_Item__c();
  10.      qi.Name = wrapper.qlineName;
  11.    qi.Quantity__c = wrapper.quantity;
  12.     qi.Unit_Price__c = wrapper.unitprice;
  13.     qi.Orginal_Price__c = wrapper.orgPrice;
  14.     qilist.add(qi);
  15.    }
  16.  
  17.   //MAP QUOTEITEM TO QUOTE AND PRODUCT
  18.    for(Integer rowIdx = 0; rowIdx < qlist.size(); rowIdx++)
  19.     qilist[rowIdx].Quote__c =qlist[rowIdx].Id      
  20.  
  21.    for(Integer rowIdx = 0; rowIdx < lstProduct.size(); rowIdx++)
  22.     qilist[rowIdx].Product__c =lstProduct[rowIdx].Id;
  23.  
  24.       insert qilist;
  25.    
  26. MetadataService.MetadataPort service = new MetadataService.MetadataPort();
  27. service.SessionHeader = new MetadataService.SessionHeader_element();
  28. service.SessionHeader.sessionId = UserInfo.getSessionId();
  29.  
  30. MetadataService.CustomField customField = new MetadataService.CustomField();
  31. customField.fullName = 'Test__c.TestField__c';
  32. customField.label = 'Test Field';
  33. customField.type_x = 'Text';
  34. customField.length = 42;
  35. MetadataService.AsyncResult[] results =
  36.     service.create(new List<MetadataService.Metadata> { customField });
  37.    
  38. Quotable_Item__c item = [select ... from Quotable_Item__c WHERE ...];
  39. List<Item_Quote> quotes = [SELECT Price__c, Quantity__c, Source__c, Id FROM Price_Quote__c WHERE Quoted_Item__c = :item.Id];
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top