Friday 4 January 2019

File contains duplicate rows, cannot insert data into staging due to unique key violation error while importing sales orders in D365 F&O / AX 7.0

Hi All,

I was getting the below error while importing the sales orders into the Ax system.

File contains duplicate rows, cannot insert data into staging due to unique key violation

Reason:

We upgraded D365 from 7.0 to 8.0 version and Microsoft added InventoryLotId field in RowIdx index and made it as an unique key in SalesOrderLineV2Staging table.

So, due to that I was not able to import any sales orders with multiple lines.But, I was able to import with a single line.


Solution:

Added "INVENTORYLOTID" field in the XML template as shown below and updated the data mapping in the sales order data entity with INVENTLOTID and changed to "Auto generated"





Afterwards, I was successfully imported the orders without any issues.

@Rahul


3 comments:

  1. Thank you very much for publishing this. I would not have found out how to solve otherwise.

    ReplyDelete
  2. Thank you for this, just saved me a project deadline.

    ReplyDelete

Adding a newline into a string in C# and X++

Below is the sample code we can use for  adding a newline after every occurrence of "@" symbol in the string in C#   using System...