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

Best practice for creating Sales Orders from an external system in D365 FO

(1) ShareShare
ReportReport
Posted on by 67

Hi everyone,

I am exploring the best approach to create Sales Orders (header + lines) in Dynamics 365 Finance & Operations from an external system integration.

So far I have tested the following options:

1. OData Using entities like SalesOrderHeadersV3 and SalesOrderLinesV3. This works, but requires multiple calls and handling the returned SalesOrderNumber before creating lines. Also, the sales order header charge needs to be handled via a custom field since the entity is not exposed via OData.

2. Data Management Framework (DMF) I also explored DMF. However:

  • Header and lines use separate entities, which again requires handling the generated SalesOrderNumber.
  • The composite entity approach requires XML payloads, which adds additional complexity for the integration.

Because of these limitations, I wanted to ask the community:

What is the recommended or best practice approach for creating Sales Orders (header + lines) from external systems in D365 FO integrations?

Specifically:

  • Is OData generally the preferred approach for this scenario?
  • Or is it better to implement a custom service / custom API that creates the order and lines in a single transaction?

I am trying to understand what approach is most commonly used in real-world integrations.

Thanks in advance for your guidance.

I have the same question (0)
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,803 Super User 2026 Season 1 on at
     
    It depends on the data integration pattern (synchronous/asynchronous), the frequency, and the volume of data.
     
     
    BR,
  • Suggested answer
    Mallesh Deshapaga Profile Picture
    1,811 on at

    Okay, I believe you have already explored all the available alternative options, and these seem to be the only available. 

    You can create a new custom data entity that combines the required fields from both the Sales Order header and line level into a single data entity. With this approach, the data coming from the third-party system can be provided in the format of this new entity. This means you would not need to pass the Sales Order header number separately for the line details.  The system can create both the Sales Order header and line records at the same time, and the Sales Order number will be generated automatically based on the number sequence.

    In the standard system, we already have the Sales Order Charges data entity: Sales order charges V2.

  • Martin Dráb Profile Picture
    239,647 Most Valuable Professional on at
    The correct answer really is: it depends. There is no universal best solution. For example, you ask whether use OData or a custom service, but you likely wouldn't want to use either for large data sets - that's where data management APIs excel.
     
    It's also questionable whether a custom service is worth the implementation effort. It usually isn't if you can use data entities, but - again - it depends.
     
    If you decide you need custom code, you may consider completely different patterns, such as actively downloading sales order data from Azure storage, rather then having another system calling an F&O API.
     
    Regarding your concern about XML, note that converting JSON to XML is very easy.
  • Verified answer
    Navneeth Nagrajan Profile Picture
    2,618 Super User 2026 Season 1 on at
     
    When integrating external systems with D365 FO to create sales orders (header and lines) the approach depends on the requirements for transactional integrity, performance and complexity. If your integration is real-time and critical, implement a custom service/use Data management framework in batch mode that wraps the standard Sales order creation logic. 
     
    OData is fine for simpler scenarios but when the scenarios are cumbersome and complex won't recommend OData.
     
    Suggestions:
    1. OData with Standard Entities
    Adv:
    - Works well for real-time integrations where the number of Sales order lines are around 1500-2000 lines.
    DisAdv:
    - Requires multiple calls, one for header and one for lines (needs Sales Order Number)
    - No native transactions across header and lines
    For real-time integration if multiple calls can be handled and the transaction volume is lower.
     
    2. Data Management Framework:
    Adv:
    - Bulk or Batch order processing
    - Handles large volumes efficiently
    Can be used if your integration is asynchronous and can run in scheduled batches.
     
    3. Custom Service/Custom API:
    Adv:
    - Recommended for large, complex approach that accepts a single payload with multiple transactional lines and ensures atomicity - where the entire order is either created or nothing is. 
    - Easier to consider additional validations and business logic.
    Uses the SysOperation Framework that is flexible and easier to integrate with external systems. Ensures data consistency and transactional integrity. Also, easier to handle custom fields and custom business logic that addresses the requirement in hand, in one place.
     
     
    Hope this helps. Happy to answer questions, if any.
     
     
  • Gurveen Kaur Bagga Profile Picture
    67 on at

    We are facing issues when trying to import Sales Orders via DMF using both separate entities (header + lines) and the Sales orders composite V4 entity.

    If the SalesOrderNumber is auto-generated (number sequence):

    • With separate entities, we cannot link lines because the SalesOrderNumber is not known at the time of import.
    • With the composite entity, even though lines are sent together inside header in XML, the import still fails with: “The specified sales order could not be found.”

    This makes it seem like the system still expects SalesOrderNumber to be explicitly provided for line linkage, even when it is auto-generated.

    Has anyone successfully created sales orders (header + lines) in a single DMF import without supplying the SalesOrderNumber? Or is this a known limitation?

    Thanks!

  • Suggested answer
    Danyal Imtiaz Khan Profile Picture
    45 on at
     
    There are several ways in which you can integrate the sales order creation from an External source to d365.
     
    Data Management Framework:
    You can use Sales Order Header and Sales Order lines data entities to create order into d365. Make sure that you are using the correct flow of creating sales order header first and then passing the sales order lines through DMF. Otherwise, you will face the issue of sales order number not found.
     
    Custom API:
    You can create a custom API in the d365 and then use the Azure function apps to communicate with that API and pass the order data in 1 single JSON format. This will directly create the order and order lines into sales tables.
    In this approach, you need to create custom forms for the configuration parameters and will also be requiring a d365 service account which will be processing the orders into d365.
     
    If you are using the call center/online store in d365, then you can go with the below option:
     
    Headless Commerce Engine:
    You can use the headless commerce API of Microsoft to create sales orders in d365 by using create sales orders API which is OOTB available. Like this you will be able to track all the sales transactions as well.
  • Verified answer
    Martin Dráb Profile Picture
    239,647 Most Valuable Professional on at
    @Gurveen Kaur Bagga Sure, you can import data through a composite entity and have IDs generated from a number sequence.
     
    Let me show you one of the approaches.
     
    I use Sales orders composite V4 entity and import the following file:
     
    <?xml version="1.0" encoding="utf-8"?>
    <Document>
      <SALESORDERHEADERV3ENTITY>
        <ORDERINGCUSTOMERACCOUNTNUMBER>CustA</ORDERINGCUSTOMERACCOUNTNUMBER>
        <SALESORDERLINEV2ENTITY>
          <ITEMNUMBER>ItemA</ITEMNUMBER>
          <ORDEREDSALESQUANTITY>1</ORDEREDSALESQUANTITY>
        </SALESORDERLINEV2ENTITY>
        <SALESORDERLINEV2ENTITY>
          <ITEMNUMBER>ItemB</ITEMNUMBER>
          <ORDEREDSALESQUANTITY>2</ORDEREDSALESQUANTITY>
        </SALESORDERLINEV2ENTITY>
      </SALESORDERHEADERV3ENTITY>
      <SALESORDERHEADERV3ENTITY>
        <ORDERINGCUSTOMERACCOUNTNUMBER>CustB</ORDERINGCUSTOMERACCOUNTNUMBER>
        <SALESORDERLINEV2ENTITY>
          <ITEMNUMBER>ItemC</ITEMNUMBER>
          <ORDEREDSALESQUANTITY>3</ORDEREDSALESQUANTITY>
        </SALESORDERLINEV2ENTITY>
        <SALESORDERLINEV2ENTITY>
          <ITEMNUMBER>ItemC</ITEMNUMBER>
          <ORDEREDSALESQUANTITY>4</ORDEREDSALESQUANTITY>
        </SALESORDERLINEV2ENTITY>
      </SALESORDERHEADERV3ENTITY>
    </Document>
    As you see, there aren't any elements for sales order numbers.
     
    In the entity mapping, I manually added a few fields:
    • Header entity:
      • SalesOrderNumber: Auto-generated
    • Line entity:
      • SalesOrderNumber: Auto default
      • InventoryLotId: Auto-generated
    I can successfully import the file, with SalesId generated and orders and lines created correctly.
  • Gurveen Kaur Bagga Profile Picture
    67 on at
    Thanks, @Martin Dráb.
     

    I was able to successfully import Sales Orders using DMF.

    The missing piece was following the steps suggested by you regarding the manual mapping of the pk fields. After incorporating those changes, the import worked as expected.

     

    We will continue evaluating where this approach makes sense vs other options.

     

    Thanks everyone for the guidance!

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 April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 139 Super User 2026 Season 1

#2
Laurens vd Tang Profile Picture

Laurens vd Tang 110 Super User 2026 Season 1

#3
Abhilash Warrier Profile Picture

Abhilash Warrier 92 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans