Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Cannot create record. The Record already exists.

(0) ShareShare
ReportReport
Posted on by 145

I have a table that I created awhile ago that all of a sudden we cannot insert records into in our test environment.  When I try to insert a new record into this table I get the error message 'Cannot create a record in {Table Name}.  The record already exists.

I used SQL Profiler to trace the SQL statement being sent to the database and found out that it is trying to insert a record into the table with the same RecId as an existing record in the table.  I figured that this must be an issue in the SYSTEMSEQUENCES table so I went into the AOT to get the Id for the table.  I confirmed that I had the correct table Id by running this SQL statement:

SELECT *

FROM     SQLDICTIONARY

WHERE  NAME = '{Table Name}'

      AND FIELDID = 0

I then ran this SQL statement to see what the SYSTEMSEQUENCES table thinks should be the next RECID:

SELECT *

FROM   SYSTEMSEQUENCES

WHERE  TABID = {Table Id}

The weird thing is that the value that the SYSTEMSEQUENCES table says should be the next RECID is correct, however that is not the value that Dynamics AX is using when it tries to create a new record, it is using a value that has already been used.

Could somebody give me some suggestions on what might be wrong and how to fix it?  I did try restarting the server and deleting all of the AUC files on my local computer.

Thank You

*This post is locked for comments

  • Dick Wenning Profile Picture
    Dick Wenning 8,705 on at
    RE: Cannot create record. The Record already exists.

    what is the table caching of this table incase of entire table cach, you get same trouble.

    fix this way

    community.dynamics.com/.../109379.aspx

  • Denis Macchinetti Profile Picture
    Denis Macchinetti 16,444 on at
    RE: Cannot create record. The Record already exists.

    Hi Eric

    Could be an uncommitted record?

    Try to have a look at mybhat.blogspot.it/.../misleading-record-already-exists-message.html

    Also, how many AOS are active ?

    Recid are cached on AOS side.

    So, the AOS restart have fix the situation.

  • Eric Maibach Profile Picture
    Eric Maibach 145 on at
    RE: Cannot create record. The Record already exists.

    I had been fighting with this for days.  I had tried rebooting the server, doing a full X++ and CIL compile and database sync, and tried rebooting the server.  However I still keep getting the issue.  Then all of a sudden this afternoon the issue went away.  I did not make any changes or do anything in between when it was not working and when it started working.

    So it is working now, but I am not sure what the issue was, or what made it start working.

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,661 Super User 2024 Season 2 on at
    RE: Cannot create record. The Record already exists.

    Hi Eric,

    Which version of AX are you using? In AX2012 there is a stored procedure used on the SQL database called 'sp_GetNextRecId'. If you are using AX2012, check if this one exists and the AOS user has execute permissions.

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,661 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,379 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans