Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Cannot Insert Multiple header in salesparmsubTable.

(0) ShareShare
ReportReport
Posted on by 286

Hi,

I try to invoice the sales order but it ends with an error.

' Cannot insert multiple records in Sales order header - updating table (SalesParmSubTable). Sales order: 12-34,  Ptv Ltd.

The record already exists.  '

Kindly suggest anyone.

*This post is locked for comments

  • Peter John Profile Picture
    Peter John 286 on at
    RE: Cannot Insert Multiple header in salesparmsubTable.

    I didn't run any batch for this process also the process I proceed in Server. I try to invoice the Sales Order when I got this error.

  • Peter John Profile Picture
    Peter John 286 on at
    RE: Cannot Insert Multiple header in salesparmsubTable.

    Hi, Mohammed.

    Thanks, I will try this and let you know.

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 292,516 Super User 2025 Season 1 on at
    RE: Cannot Insert Multiple header in salesparmsubTable.

    Hi,

    Are you running the update in batch or on the client when you get this error? Possibly, you can create a ticket for Microsoft Support if you don't have customizations. I couldn't find quickly a known issue on LCS issue search.

  • Suggested answer
    Mohammed Khatib Profile Picture
    Mohammed Khatib 430 on at
    RE: Cannot Insert Multiple header in salesparmsubTable.

    I believe you have to remove the line recordInsertParmSubTable.insertDatabase(). The out of the box insert method on SalesParmTable table is already populating the records to the SalesParmSubTable, as below:

    Code: SalesParmTable --> Insert Method

    pastedimage1565289691144v1.png

  • Peter John Profile Picture
    Peter John 286 on at
    RE: Cannot Insert Multiple header in salesparmsubTable.

    Hi, Andre.

    The method goes here and checks the unique values. But the result same I stuck with this error anyway 

    pastedimage1565239469582v1.png

    Thanks,

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 292,516 Super User 2025 Season 1 on at
    RE: Cannot Insert Multiple header in salesparmsubTable.

    Hi User1,

    What is the logic in the method 'existsParmSubTable'? Does this check all unique indexes?

  • Peter John Profile Picture
    Peter John 286 on at
    RE: Cannot Insert Multiple header in salesparmsubTable.

    Hi, Andre.

    Don't have any customizations and new fields. And also the salesparmsubtable insert process is recordinsertlist. Before adding to the list also they check the duplicate records. The unique records only inserted to salesparmsubtable. Plz refer the below screenshots

    While checking the records before adding to the insertrecordlist

    pastedimage1564648527920v2.png

    Added to the recordinsertlist

    pastedimage1564648659056v3.png

    recordinsertlist, insert to the table(SalesParmSubTable) getting the error, line-7

    pastedimage1564648814212v4.png

  • Peter John Profile Picture
    Peter John 286 on at
    RE: Cannot Insert Multiple header in salesparmsubTable.

    Hi, Mohammed.

    Yes, I have checked while debugging the code these fields are always getting unique records.

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 292,516 Super User 2025 Season 1 on at
    RE: Cannot Insert Multiple header in salesparmsubTable.

    In addition: check if you have customizations (e.g. new field and/or new or changed index which doesn't allow for duplicates) which could cause this issue as well.

  • Suggested answer
    Mohammed Khatib Profile Picture
    Mohammed Khatib 430 on at
    RE: Cannot Insert Multiple header in salesparmsubTable.

    The primary index on SalesParmSubTable is a combination of the following fields:

    1- ParmId

    2- TableRefId

    3- OrigSalesId

    4- subId

    Make sure that these four field values are unique.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,321 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans