2

What we want to do

We want to create both a sales header and the corresponding sales lines in one API call.

How we're trying to do it

To do this we're trying to do a deep insert as specified in the OData spec.

Example

POST http://our-nav-host:12202/NAV110_TEST/ODataV4/Company('CompanyName')/SalesOrder
{
    "No": "1234",
    "Sell_to_Customer_No": "1234",
    "Sell_to_Customer_Name": "Test",
    "Sell_to_Address": "Teststreet 56",
    "Sell_to_Address_2": "",
    "Sell_to_Post_Code": "1234",
    "Sell_to_City": "Test",
    "SalesOrderSalesLines": [
        {
            "Document_Type": "Order",
            "Document_No": "1234",
            "Line_No": 10000,
            "Type": "Item",
            "No": "21981"
        }
    ]
}

We get a 200 OK and the sales header is created but without any sales lines.

NAV Config

We have published a web service for page 42 (Sales Order) and we're using the corresponding OData V4 URL in the call.

SOAP

If we try to do the same with the SOAP URL and a SOAP-call it works. The sales order is created with the sales lines. But we would very much like to NOT use SOAP.

Jacob Rastad
  • 1,153
  • 10
  • 24
  • Using the NAV interface the user cannot make both a sales header and lines in 'one call'... I would recommend to create a Sales Header first, then create multiple Sales Lines. [Example](https://blogs.msdn.microsoft.com/freddyk/2009/11/17/extending-page-web-services-and-creating-a-sales-order-again/) – ian_scho Dec 10 '18 at 07:26
  • Thank you @ian_scho for commenting. I can create both sales header and sales lines in one call using SOAP to the same page (42). I've stumbled upon the link you provided in my search but I think that info isn't applicable to NAV 2018. Since it works via SOAP. – Jacob Rastad Dec 10 '18 at 20:54
  • Did you find a solution? – Joey Carlisle Apr 15 '22 at 15:05
  • 1
    @JoeyCarlisle no unfortunately not. We ended up using SOAP (yuck) instead. We've "heard" that this works in BC but we haven't upgraded and tested. – Jacob Rastad Apr 17 '22 at 09:43

0 Answers0