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

Error when importing multiple sales order lines using templates sales order lines v3 in D365 F&O

(5) ShareShare
ReportReport
Posted on by 135

Hello everyone,

 

I’m facing an issue in Dynamics 365 Finance and Operations when trying to upload sales order lines to existing sales orders using templates.

 

The problem is that if I upload a template with a single line, it works fine. But if I try to upload multiple lines, I get the following error:

 
 

"Cannot insert record in staging table. Record keys are DEFINITIONGROUP, EXECUTIONID, INVENTORYLOTID, PARTITION. Duplicate records must be removed from the file before importing."

 

The thing is, I’m not repeating any data. I actually need to upload multiple items into the same sales order, so this error doesn’t make sense to me.

 

Has anyone faced this issue or knows why D365 is treating my lines as duplicates when they are not?

 

Thanks in advance.

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    305,150 Super User 2026 Season 1 on at
    Hi Sergio,
     
    Do you have a column for the field InventoryLotId in the source file? If so, I do assume you left the value blank. In that case, remove this field from the file to have it defaulted by standard logic. In case you have the field with a blank value, it is causing the duplicate.
  • Suggested answer
    Sergio_Vasquez Profile Picture
    135 on at
    Hello , yes, you’re right. I actually removed that field because the number sequence is automatic, and if I leave it blank or with any value it throws a different error. In this case I can confirm that I’m not uploading this field.
  • Suggested answer
    Syed Haris Shah Profile Picture
    1,661 Super User 2026 Season 1 on at
     
    Are you including the Line Number (LineNum) in your source file? If not, please add a Line Number column and assign a unique number to each sales line — for example: 1, 2, 3, etc.
    Also, I recommend downloading a fresh source template, populating it with the correct line information (including LineNum), and then importing it using a new data project and execution ID to avoid any conflicts from previous runs.
     
    If you find this answer helpful, please consider verifying the answer. 👍
     
    Regards,
    Syed Haris Shah
  • Verified answer
    CA Neeraj Kumar Profile Picture
    5,135 Super User 2026 Season 1 on at
     
    I agree with @Syed Haris Shah and @André Arnaud de Calavon responses.
     
    In the past i was facing the same issue, couldn't get the root cause but i was able to complete my tasks using SalesOrderLinesV2Entity and also documented the same that time, sharing the steps from that document. Hope it helps.
     
    Steps that i followed:
    1. Use these sales order number to prepare data for Sales order lines entity.

    Sample file attached:
     
    1. Add Data entity for “Sales order lines V2”. Update the mapping as given below:
    Select Auto-generated for InventoryLotId. [you are already aware and @André Arnaud de Calavon has also mentioned in his reply]

    1. Import the file and check the output.
    1. Sales order lines created as below:
     
    You can give a try to this entity as well, it's always better to identify the root cause but parallely, we should also have some solution to move ahead.
     
    If this helped, please mark it as "Verified" for others facing the same issue Keep in mind that it is possible to mark more than one answer as verified
     
    Regards,
    Neeraj Kumar

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... 164 Super User 2026 Season 1

#2
Laurens vd Tang Profile Picture

Laurens vd Tang 106 Super User 2026 Season 1

#3
Zain Mehmood Profile Picture

Zain Mehmood 89 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans