Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
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,083 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 225,672 Super User 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,083 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/.../

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,420 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,672 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans