Forum Discussion

al3's avatar
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);
	}

 

 

 

    • Melisa_D's avatar
      Melisa_D
      Former Staff

      Hi al3

       

      Thanks for the update. Glad to hear that it is working again! 

       

      Feel free to come back to the Community Forum in future if you have anymore questions, we are more than happy to assist.

      • al3's avatar
        al3

        Hi 

        The error is back 

         

        ErrorError.NameError.MessageError.AdditionalDetailsError.ErrorCodeError.SeverityError.LearnMore
        MYOB.AccountRight.SDK.ErrorUidInPostBodyA request should not contain UID during POST operation 173Error