web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Answered

Recommended way to create Sales Order header + lines via OData in Dynamics 365 F&O

(0) ShareShare
ReportReport
Posted on by 45

We are integrating an external OMS with Dynamics 365 Finance & Operations and creating Sales Orders using the standard OData entities:

  • SalesOrderHeadersV4
  • SalesOrderLinesV3

Our current flow is:

  1. Create Sales Order Header via OData (POST /data/SalesOrderHeadersV4)
  2. Retrieve the generated SalesOrderNumber
  3. Create lines via POST /data/SalesOrderLinesV3

This works, but because header and lines are separate calls we must handle several edge cases in our integration layer:

  • Header succeeds but line creation fails
  • Some lines succeed and some fail
  • Retry logic may create duplicate headers
  • Need to implement idempotency and reconciliation logic

We explored OData batch (/data/$batch) with a single changeset to make the operation atomic. The goal was to create header and lines in the same batch request.

However, referencing the created header inside the batch (for example using $1/... patterns similar to the OData documentation examples) results in URI errors in D365, suggesting that SalesOrderLinesV3 may not be exposed as a navigation path from SalesOrderHeadersV4.

Because of this, we are trying to understand the recommended integration pattern for this scenario.

Questions:

  1. Is there a supported way to create a Sales Order header and lines atomically via OData in D365 F&O?
  2. Is OData batch intended to work for this scenario with these entities?
  3. If not, is the recommended approach to create the header first and then create lines while handling idempotency and retries in the integration layer?
  4. Alternatively, should Data Management / composite entities be used for this type of document-style import even for near-real-time integrations?

Any guidance on the recommended approach for creating Sales Orders from external systems would be greatly appreciated.

Thanks!

I have the same question (0)
  • Verified answer
    Ajit Profile Picture
    8,788 on at
    I would go with the custom web service (single payload for a header and lines) in this scenario since you need real\near real time. 
  • Verified answer
    Navneeth Nagrajan Profile Picture
    2,572 Super User 2026 Season 1 on at

    Suggestions:
    Suggestions to the set of questions:
    1. Is there a supported way to create a Sales Order header and lines atomically via OData in D365 F&O?
       A] No D365 F&O doesn't support automatic creation of Sales Order header and lines using Standard OData Entities. However, you can leverage tools like Model Context Protocol (MCP),customer service or Power Automate flows through Business events to create Sales orders automatically in D365 F&O. 
       
    2. Is OData batch intended to work for this scenario with these entities?  
      A] Instead of an Odata batch would prefer using a SysOperation Framework custom service to work through the scenario of creation of sales orders. Odata does not gurantee transactional consistencies across multiple entities.
     
     
              3. If not, is the recommended approach to create the header first and then create lines while handling idempotency and retries in the integration layer?
              A] The other approaches you can adopt is using the integration layer logic where 
                     -  Create the header first
                     -  Implement indempotency using an external identifier like Document Number or a custom field in D365. 
                     -  Post lines individually in parallel using Multi-threading batch capabilities. 
                  The second approach is to use composite data entities where you import header and lines together in a single package. If DMF is typically for batch
                  imports, it can be triggered via Data management OData API for near real-time integration. 
     
                4. Alternatively, should Data Management / composite entities be used for this type of document-style import even for near-real-time integrations?
               A] If you use document style atomicity then yes composite entities considering header and lines together as a single package.
                   If you have complex logic or latency involvement in the real-time integrations, then would recommend composite entities or data management entities
                   integrated with middle ware components like Azure Logic Apps. Wouldn't recommend using OData at all in this case considering transaction volume and latency.

     
    References:

    Hope this helps. Happy to answer questions, if any.
  • Gurveen Kaur Bagga Profile Picture
    45 on at

    Thanks @Ajit and @Navneeth Nagrajan for the helpful responses.

    This clarifies that standard OData entities don’t support atomic creation of Sales Order header and lines in D365 F&O.

    The suggestion of implementing a custom service (single payload for header and lines) seems like a good option for achieving transactional consistency for real-time integrations.

    Appreciate the guidance and references shared.

  • Ajit Profile Picture
    8,788 on at
    Sounds good. Please mark the answer as verified if you think suggested option is helpful. thank you. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
Mallesh Deshapaga Profile Picture

Mallesh Deshapaga 326

#2
Laurens vd Tang Profile Picture

Laurens vd Tang 233 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 136 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans