You need to sign in to do that
Don't have an account?
Jacob Riff
Creating QuoteLineItem using Apex
For some reason this fails - q.QuoteLineItems is null. Can someone tell me why?
@isTest private class QuoteTest { static Account A; static Opportunity o; static Quote q; static Product2 p; static PriceBookEntry pe; static OpportunityLineItem oli; static QuoteLineItem qli; static { a = new Account(name = 'Test account', Jurisdiction__c = 'Denmark', currencyIsoCode = 'DKK'); insert a; o = new Opportunity(name = 'Test opportunity', AccountId = a.id, closeDate = date.today(), stageName = 'Demonstration Scheduled'); insert o; p = new Product2(name = 'Test product', type__c = 'Subscription', limits__c='a;b\nc;d'); insert p; Id pbId = Test.getStandardPricebookId(); pe = new PriceBookEntry(PriceBook2Id = pbId, Product2Id = p.id, UnitPrice = 100, IsActive = true); insert pe; oli = new OpportunityLineItem(OpportunityId = o.id, Quantity = 1, PricebookEntryId = pe.id, totalPrice = 200); insert oli; q = new Quote(name = 'Test quote', OpportunityId = o.id, PriceBook2Id = pbId); insert q; qli = new QuoteLineItem(QuoteId = q.id, PriceBookentryId = pe.Id, Quantity = 1, UnitPrice = 1); insert qli; System.debug(q); System.debug(qli); System.debug(q.QuoteLineItems); }
Please try the following query:
Thanks!
Replace line no 37 "System.debug(q.QuoteLineItems);" with that code:
Thank You!
Rajendra