Microsoft Dynamics AX Error: The Record Already Exists

by | Updated January 17, 2018 | Development, Dynamics AX

I was recently working on an issue in Dynamics AX where, after a code move we started receiving the error: ‘Cannot create a record in “TableName.” The record already exists.’

One of the most common reasons for this error is, one of the unique index fields has duplicated value. I verified all the unique index requirements were satisfied and there were no duplicated index values.

After investigating, I found out that the RecId generated by the system was getting a value that has been previously used.

The RecId sequence for tables is stored in SystemSequences table and can get out of sync due to one/more of the following reasons:

1.       Data is inserted in the SQL database directly

2.       There has been tableId conflicts during model store move

To fix this error, we need to reset the NextVal field in SystemSequences table. NextVal field should be set to a value greater than the max RecId of the table.

Steps to resolve the error ‘record already exists’:

1.       Get the tableId for the table.

a.       You can find the tableId from AOT, under Properties for the table.

Cust Tablesyste

b.      You can run a job to display the tableId in infolog.

Get table from table name

2.       Open SQL Server Management Studio and get the max value for RecId for the table, from SystemSequences table.

3.       Update the NextVal field to a value greater than the max RecId of the table.

4.       Restart the AOS.

Related Posts

4 Comments

  1. venkat

    i have done the suggested fix but no luck. can you suggest me a fix.

  2. Brandon Carmichael

    Hello Venkat,

    If you followed the steps outline by Ramesh in the blog, I am unsure how to help without seeing or being in your environment. I would suggest reaching out to your partner to see if they can help. If that is not an option, if the issue continues, or if it escalates we do offer support plans that can be used a variety of ways.

    Thanks,
    Brandon

  3. mike

    I confirmed the field for the table in systemsequences is TABID instead of TableID in AX2012, earlier versions might be TableID.

  4. Taylor Valnes

    Mike,

    Thank you for pointing this out, the blog has been updated now as well.

    Regards,
    Taylor

Submit a Comment

Your email address will not be published. Required fields are marked *

Upcoming Events

september

02sep10:00 am10:30 amThe Modern Manufacturer - Cycle Count Management

02sep12:00 pm12:30 pmBest Practices for Work Order Planning and Routing for Field Service Companies

09sep10:00 am11:00 amWhat is Levridge? An Overview of the Ultimate Ag Solution

09sep12:00 pm12:30 pmOverview of Microsoft Promotion for NAV and GP Clients

10sep11:00 am12:00 pmConfab with Stoneridge - Livestream - Field Service Comparisons

16sep10:00 am10:30 amThe Modern Manufacturer - Product Lifecycle Management

16sep12:00 pm12:30 pmHow to Upgrade to Dynamics 365 Finance and Operations: Examining Custom Code and ISV Implications

16sep2:00 pm2:30 pmScheduling and Dispatching for the Modern Field Service Company

23sep12:00 pm1:00 pmDynamics 365 Business Central Wave 2 Release Preview - An Overview of the Most Exciting New Features Coming in October

24sep11:00 am12:00 pmConfab with Stoneridge - Livestream - The Modern Workplace: Teams, Sharepoint, Outlook, Office, and AI Integration

30sep10:00 am10:30 amThe Modern Manufacturer - Return Management

30sep12:00 pm12:30 pmEmpowering Your Field Service Technicians with a Mobile Solution

october

07oct12:00 pm1:00 pmThe Three Paths to Business Central from Dynamics GP

08oct11:00 am12:00 pmConfab with Stoneridge - Livestream - The Vision and Strategy of Microsoft Business Systems

14oct10:00 am10:30 amThe Modern Manufacturer - Complex Cost Modeling

14oct12:00 pm12:30 pmGenerating Custom Inspection or Process Forms

19octAll Day22Stoneridge Connect Fall 2020

22oct11:00 am12:00 pmConfab with Stoneridge - Livestream - Stoneridge Connect Recap

28oct10:00 am10:30 amThe Modern Manufacturer - Engineering Change Orders

About Stoneridge
Stoneridge Software is a unique Microsoft Gold Partner, with emphasis on partner. With specialties in Microsoft Dynamics 365, Microsoft Dynamics AX, Microsoft Dynamics NAV, Microsoft Dynamics GP and Microsoft Dynamics CRM, we focus on attracting the most knowledgeable experts in the field to our team, and prioritize delivering stellar solutions with maximum impact for your business. At Stoneridge, we are deeply committed to your results. Each engagement is met with a dedicated team, ready to provide thorough, tailored, and expert service. Based in Minnesota, we intentionally “step into your shoes,” wherever you are. We focus on what you care about, and develop trusting, long-term relationships with our clients.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!

X