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
Jared RoachJared Roach 

API: Add quotelineitem to a quote .net c# JSON request

Hi,

I have been trying to add QuoteLineItems to a Quote I am creating. Can someone help me with the format for the QuoteLineLitem please?

I am posting to services/data/v53.0/sobjects/Quote/ and my JSON string is shown below:

{"Name":"dwtest dwtest","OpportunityId":"0060800000w0lp7AAA","Delivery__c":50.00,"Tax":19.850,"Email":"l@dw1.co.uk (mailto:l@dw1.co.uk" style="color:#0563c1; text-decoration:underline)","PaidFlag__c":true,"BillingName":"dwtest dwtest","BillingStreet":"Designer Websites Ltd\r\nSully Moors Road Sully","BillingCity":"Penarth","BillingPostalCode":"CF64 5RP","BillingState":"South Glamorgan","ShippingName":"dwtest dwtest","ShippingStreet":"Designer Websites Ltd\r\nSully Moors Road, Sully,","ShippingCity":"Penarth","ShippingPostalCode":"CF64 5RP","ShippingState":"South Glamorgan","Phone":"0123456789","New_Probability__c":"1","QuoteLineItems":{"records":[{"ServiceDate":"2022-01-12T00:00:00+00:00","Description":"2cm Quartz Twilight","Quantity":2,"UnitPrice":34.56,"TotalPrice":69.12}]}}


Error Message:
"[{\"message\":\"Quote: bad field names on insert/update call: QuoteLineItems\",\"errorCode\":\"INVALID_FIELD_FOR_INSERT_UPDATE\",\"fields\":[\"QuoteLineItems\"]}]"

Can anyone help with this please?

 

 

 

SwethaSwetha (Salesforce Developers) 
HI Jared,
Have you checked if the user has access to create QuoteLineItems?

Considerations as per https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_quotelineitem.htm

"When you create or update a QuoteLineItem, the API verifies that the line item corresponds to a PricebookEntry in the Pricebook2 that is associated with the quote."

Thanks