Microsoft Dynamics AX Error: The Record Already Exists

by | Jul 8, 2016 | 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.

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

may

28may1:00 pm1:30 pmHow to Implement Microsoft Dynamics: Designing the Software Collaboratively

june

02jun1:00 pm1:30 pmHow to Implement Microsoft Dynamics: Conference Room Pilots

03jun10:00 am10:30 amWhy Levridge Grain? Streamlining Sales Contracts

04jun11:00 am12:00 pmConfab With Stoneridge - Livestream - Customer Insights

04jun1:00 pm1:30 pmHow to Implement Microsoft Dynamics: Dealing with Challenges Mid-Project

09jun1:00 pm1:30 pmHow to Implement Microsoft Dynamics: Customizations vs Configurations and How You Manage Them

10jun10:00 am11:00 amOn the Job with Dynamics 365 - Manufacturing Buyer

11jun1:00 pm1:30 pmHow to Implement Microsoft Dynamics: Data Migration - Early and Often

15jun(jun 15)9:00 am16(jun 16)4:00 pmDynamics 365 Finance and Supply Chain Management Training for AX 2012 Developers

16jun1:00 pm1:30 pmHow to Implement Microsoft Dynamics: Environment Management and Deployments

17jun10:00 am10:30 amWhy Levridge Grain? Best Practices for Managing Load Orders for Grain Processors

17jun12:00 pm1:00 pmMobilizing an efficient, streamlined AP department with AP Automation

17jun2:00 pm3:00 pmGuide for B2B Businesses: Tackling Supply Chain Optimization and Customer Experience Challenges

18jun11:00 am12:00 pmConfab with Stoneridge - Livestream - Enterprise Asset Management and Preventative Maintenance

18jun1:00 pm1:30 pmHow to Implement Microsoft Dynamics: Testing - Definition and Activities

23jun1:00 pm1:30 pmHow to Implement Microsoft Dynamics: Training for All

24jun10:00 am11:00 amOn the Job with Dynamics 365 - Manufacturing Production Manager

25jun1:00 pm1:30 pmHow to Implement Microsoft Dynamics: Going Live

30jun1:00 pm1:30 pmHow to Implement Microsoft Dynamics: Hypercare

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