Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

Getting record already exists error for my custom tables when inserting new data.

Posted on by

Hi Experts,

I have custom table in which have inserted lot of data, now to move this data to other environment i generated sql script with data only option the script shows recid's

When i import xpo to other environment & run the data script , i can see everything just fine however while inserting new data via form i get 

"Cannot create a record in mycustom table.
The record already exists."

I suspect this is due to the fact that recid;s are getting created when importing data , please suggest a fix.

pastedimage1607025079028v1.png

pastedimage1607025243408v2.png

  • Mav Profile Picture
    Mav on at
    RE: Getting record already exists error for my custom tables when inserting new data.

    Issue resolved by rebooting Ax.

  • Mav Profile Picture
    Mav on at
    RE: Getting record already exists error for my custom tables when inserting new data.

    Here is the sequence

    1>Ran sql script to add data into table

    2>Created dat file using DIEF Export

    3>Truncated the tables used in sql script.

    4>Imported dat file using DIEF import

    5>Realized that table is missing in defination group used in DIEF.

    6>Change definition group to add the table

    7>Exported new DAT file & BIN file

    8>Trying to import get ""File did not contain any valid data" error

    9>Restarted Ax services

    10 >Retry & got same error.

  • Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 on at
    RE: Getting record already exists error for my custom tables when inserting new data.

    Hi Mav,

    What changes did you make before restart? Did you delete data imported via SQL script and imported it through DIEF?

  • Mav Profile Picture
    Mav on at
    RE: Getting record already exists error for my custom tables when inserting new data.

    DIXIF will be too much of effort

    DIEF was working fine , however when i just added a table to def group it started giving error "File did not contain any valid data"

    Only change between working DIEF & now not working DIEF is i removed & added table to defination group.

    I have restarted the ax services & yet getting same error, any ideas .

  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,214 Most Valuable Professional on at
    RE: Getting record already exists error for my custom tables when inserting new data.

    Importing data directly to database is a terrible idea. Never do it! You may ruin your environment.

    There are many reasons, one of them is that RecId are assign from a system sequence and now your data isn't in sync with it. The system assignes a new RecId from the sequence, but you alteady have that imported.

    You can use the Data Import/Export Framework to do the job in a correct way.

  • Verified answer
    Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 on at
    RE: Getting record already exists error for my custom tables when inserting new data.

    Hi Mav,

    RecIds are generated and stored in an internal table, so it's expected that you will have issues with RecId generation from new data as the next RecId value was not updated for your table.

    I would use existing tools to export\import data instead of SQL script to move data between instances like old school export\import or DIXF.

    docs.microsoft.com/.../export-data-to-another-instance-of-microsoft-dynamics-ax

    Also, you can try to fix RecId sequence in internal table

    stoneridgesoftware.com/.../

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans