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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
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
 
 
 
  • Verified answer
    Martin Dráb Profile Picture
    240,815 Most Valuable Professional on at
    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.
  • CU27040934-11 Profile Picture
    12 on at
    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).
     
  • Martin Dráb Profile Picture
    240,815 Most Valuable Professional on at
    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".
  • LI-27040850-0 Profile Picture
    2 on at
    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.
     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 475 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 399 Super User 2026 Season 2

#3
CU10121822-0 Profile Picture

CU10121822-0 374

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans