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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Cannot insert multiple records in Vendor invoice lines. The record already exists

(0) ShareShare
ReportReport
Posted on by

Hi 

While invoice matching in Accounts payable, an error occured. Is it a locking in the tables?

2018_2D00_05_2D00_17_5F00_17h29_5F00_34.png

*This post is locked for comments

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    300,731 Super User 2025 Season 2 on at
    RE: Cannot insert multiple records in Vendor invoice lines. The record already exists

    Not completely sure, but did you setup the Increment field on the System parameters?

  • Community Member Profile Picture
    on at
    RE: Cannot insert multiple records in Vendor invoice lines. The record already exists

    Hi André - yes, by 1 in the System Line number field. Havn´t found an solution. The Invoice- PO matching is for like + 100 POs to one invoice (summary invoice). Cannot find the anything interesting in the pending invoice form. Any clue where to proceed? Thanks for your effort.

  • André Arnaud de Calavon Profile Picture
    300,731 Super User 2025 Season 2 on at
    RE: Cannot insert multiple records in Vendor invoice lines. The record already exists

    Hi Bob,

    There is one unique index on this table which holds a LineNum field. In my environment it has 4 fields. Can you verifiy if the TableRefIdx index in your environment also has 4 fields? (TableRefId, OrigPurchId, LineNum, RecId). In my environment there is a KB number visible on this index (KB3199741) which might indicate that there was a fix in the past for a certain issue. Probably the issue you are facing now, but I'm not sure.

  • _MGP Profile Picture
    506 on at
    RE: Cannot insert multiple records in Vendor invoice lines. The record already exists

    I found this post looking for help on creating an import routine for vendor invoice lines after hitting the same error message on Line number.

    Having created a line manually in the form I was trying to use a simple Job to first create a new line in x++ by copying the existing line using buf2buf() and then changing the VendInvoiceInfoLine.LineNum to a new number but I kept getting the error message.

    It turns out there is another unique index (unique across companies too) on the VendInvoiceInfoLine table (SourceDocumentLine) that covers VendInvoiceInfoLine.SourceDocumentLine. You need to reset this to 0 before calling VendInvoiceInfoLine.write() and this creates a unique value that satisfies the index.

    Not sure why AX thinks that the Line number is a problem when it appears that it isn't (in my case at least).

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 3

#3
Scott_itD Profile Picture

Scott_itD 2 Community Manager

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans