Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

RecordInsertList.add(Common) Method error

(0) ShareShare
ReportReport
Posted on by 12
Hi,
 
I'm using RecordInsertList to insert records.
There is same record has existed in DB, so the error should be throw when insertDatabase() called.
I understand that the add method only insert buffer to memory, but the method add throw error Microsoft.Dynamics.Ax.Xpp.DuplicateKeyNotRecoveredException
 
 
 
  • RecordInsertList.add(Common) Method error
    Same problem here.
    If I skip RecordInsertList the problem doesn't appear, so it is not related to the data itself.
    Always come at record count 63 not depends the field values.
    Really annoying.
     
  • Martin Dráb Profile Picture
    Martin Dráb 230,868 Most Valuable Professional on at
    RecordInsertList.add(Common) Method error
    It's not the most detailed explanation, but the information is there.
     
    You see that "The add method can flush records to the database [...]" and "insertDatabase method [is used] to insert all remaining records".
     
    You can also read that "Records are inserted only when the kernel finds the time appropriate, but no later than the call to the insertDatabase". This contradicts your original assumption, which can be formulated like "Records are inserted only when insertDatabase is called".
  • Community member Profile Picture
    Community member 12 on at
    RecordInsertList.add(Common) Method error
    Thank Martin,
     
    Ive already read document for every method of class, and a lot of other post on google before posted a question, but I cant guess the add method do insert by batch of records.
    (the google translate "flush" = "delete", my bad).
     
  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,868 Most Valuable Professional on at
    RecordInsertList.add(Common) Method error
    No, your understand isn't correct. You believe that if you add a million records, the systems holds all of them in memory and that it makes a single insert with million rows. That's not what RecordInsertList is for.
     
    RecordInsertList adds records in bathes (if possible), but not necessarily in just a single batch. For example, if decides to insert records in a batch of 100 records, there are inserts to DB when you call add() for the 100th record, 200th record and so on. insertDatabase() just ensures that remaining records, that haven't been inserted yet, are inserted too.
     
    Note that you should consult the documentation if you're unsure about how something works. In this case, you can find it under RecordInsertList Class.

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…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,868 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans