function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
shan razshan raz 

QuoteLineItem TestClass Error : Required fields are missing: [Quantity]: [Quantity]??

So I am writing test class for QuoteLineItems and I keep recieving the following error when Quantity is clearly there:

System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Quantity]: [Quantity]
QuoteLineItem qliliner = new QuoteLineItem(QuoteId=quoteObj.id,
                                                    Quantity = 1,
                                                    UnitPrice = 5.00,
                                                    Product2Id=producto.id,
                                                    PriceBookEntryID=pbe.Id,
                                                    Tax_Code__c=taxcode);
insert qliliner;

 
VinayVinay (Salesforce Developers) 
Hi Shan,

Are you using 'seeAlldata=true' in your test class?

If you are using can you remove and try again.

Thanks,
Vinay Kumar
shan razshan raz
No Vinay that did not work but thank you :)