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 :
Finance | Project Operations, Human Resources, ...
Answered

Duplication Key Error When Using Custom Number Sequence

(0) ShareShare
ReportReport
Posted on by 66
 
Hey D365FO community!
I hope you're all doing well. I'm currently working on a project in D365FO as a developer, and I've hit a roadblock that I could use some assistance with. Here's a breakdown of the issue:
**The Problem:**
I created a custom number sequence and linked it as an index for a new table. Initially, everything seemed to be working fine. However, I'm now encountering a duplication key error that I can't seem to resolve.
 
**What I've Tried So Far:**
I've attempted to delete all records associated with this number sequence and even created a new one from scratch, but the error persists.
I delete the key and it didntt solve the prblm
It seems like there's an underlying issue that I haven't been able to identify.
 
**Additional Information:**
To provide more context, here are some additional details:
- I make sure that no other insert or doinsert call are done before

 
 
I'm open to any suggestions or insights you may have. Thanks in advance for your help!
I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,668 Most Valuable Professional on at
    Duplication Key Error When Using Custom Number Sequence
    I suggest the following:
     
    1. Stop in debugger in insert().
    2. Open SSMS and check out if the value already exists in database. If so, it means that you number sequence conflicts with existing data.
    3. If you don't see it in committed data, try uncommitted (e.g. by WITH (NOLOCK)). If so, it seems that the same value is inserted twice in the same transaction.
    4. If nothing is there, you probably have a problem with a different unique index. The error message mentions a field from the primary index, but the actually conflicting index may be different.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 683 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 563 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 398 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans