Skip to main content

Dynamics 365 Business Central - [ERROR] The record in table Sales Line already exists

Micah A. Parker avatar
Written by Micah A. Parker
Updated over a month ago

Product: Dynamics 365 Business Central

Error: Error: Internal_EntityWithSameKeyExists The record in table Sales Line already exists


Issue: When exporting out a Purchase Order (850) from Transaction Manager you receive the following error: 'Error: Internal_EntityWithSameKeyExists The record in table Sales Line already exists.'

Reason: During creation or updating of the Sales Order within Dynamics 365 Business Central, the Line # passed in was found to already of been used.

Solution - Ensure Line Numbers are Unique


If you're passing multiple Items or adding a Line Item that doesn't exist on the incoming Transaction either through Mapping Manager or through a script on Sales Order creation you need to ensure that the Line Numbers are not repeated.

Mapping Manager

Update the lineNumber within Transaction Manager to either properly push the Line # sent by your Trading Partner, or use the [I:Item Loop Index] token (found under Tools β†’ AccountInfo to auto-sequence the Line Number

Navigate: Partner Maps β†’ Purchase Order

Select: Edit

Select: SalesOrderLines β†’ Details (from Row/Column Selection)

Map: lineNumber

Customization

If a script customization has been added by your Value Added Reseller (VAR) or Consultant - you will need to have them update the solution to use a different Line Number value, such as 1000, 2000, or 3000 to avoid conflicts of Line Numbers that your Trading Partner may be sending instead.

rev 5/1/2025

Did this answer your question?