3 years ago
Error with trying to insert ItemInvoice Lines
I am getting the following error "A request should not contain UID during POST operation"
This is after I created an Item Invoice Header and then try and add Item Lines to the Invoice Header. This has worked for over 3 years. After I got the error I updated all the NuGet packages etc and still get the error. It is written in c# 4.5. Here is the code cut-down version of the code
ItemInvoice invoice = new ItemInvoice(); List<ItemInvoiceLine> lines = new List<ItemInvoiceLine>(); CustomerLink customer = new CustomerLink(); customer.UID = customerUID; invoice.Customer = customer; invoice.Date = Date; invoice.IsTaxInclusive = false; invoice.CustomerPurchaseOrderNumber = PurchaseOrder ; invoice.InvoiceDeliveryStatus = DocumentAction.Email; // Create Invoice Header invoice = ws.insertItemInvoice(invoice); // Add Invoice Lines to Invoice foreach (var orderline in orderLines) { ItemInvoiceLine line = new ItemInvoiceLine(); ItemLink item = new ItemLink(); item.UID = orderline.ItemUID; line.Item = item; line.Description= orderline.Description; line.ShipQuantity = (decimal)orderline.Quantity; line.UnitPrice = (decimal)orderline.SellingPrice; TaxCodeLink taxCode = new TaxCodeLink(); taxCode.UID = TaxUID; line.TaxCode = taxCode; lines.Add(line); orderline.SaleUID = invoice.UID; invoice.Lines = lines; var itemInvoiceSvc = new ItemInvoiceService(_configurationCloud, null, _oAuthKeyService); itemInvoiceSvc.InsertEx(companyFile, invoice, credentials); }