web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Unique key violation while importing through data entity

(0) ShareShare
ReportReport
Posted on by 302

Hello All,

I created a new entity for InventTrans table. As there is no unique index in the table I had to create the entity with inventTransRecId field as entity key(Followed statndard GeneralJournalAccountEntryEntity).

When I tried to import I am getting the following error,

File contains duplicate rows, cannot insert data into staging due to unique key violation.- '0' 'General journal account entry' record(s) inserted in staging

As RecId field in the import file is empty. Can any please suggest me what I am missing here. Even the standard entity throws the same error.

Thanks

  • Suggested answer
    nmaenpaa Profile Picture
    101,174 Moderator on at

    You should never import data to InventTrans table!

    InventTrans is maintained by the system, based on different postings in the system, for example Sales/Purchase/Transfer/Production orders and different inventory journals.

    What is the business requirement that you are trying to solve?

  • Wekey Profile Picture
    302 on at

    Hello Nikolaos,

    Its not about the inventTrans table. I have similar entity with no unique index have to used for import purpose.

    I am not sure about the business requirement however it is advisable to import for the following tables?

    For Example: JmgProfileCalendar, JmgProfileSpec, PriceDiscTable, JmgPayAgreementLines.

    Thanks

  • Verified answer
    nmaenpaa Profile Picture
    101,174 Moderator on at

    If it's not about InventTrans table then why did you mention it? It made me think it's about InventTrans table.

    You can't use data entities to import to tables where there is no natural key.

    For PriceDiscTable you should use Trade agreement journals to import data. You can import data to Trade agreement journal via data entity.

    For the other tables that you mention I don't have a direct answer since I'm not familiar with them. Perhaps there's a function in the system that generates data to these tables, based on some rules? And you should use that generator to generate data.

    Another general solution is to create your own intermediary table that has a natural key. Import data to this table, and then copy data from this table to the actual target table via x++ code.

    Data entities can't handle import scenarios without a natural key. How would the system know when it needs to insert a record and when it needs to update an existing record, if your entity doesn't have a natural key?

  • skpaliwal Profile Picture
    Microsoft Employee on at

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 239 Super User 2026 Season 2

#2
Aayush Tiwari Profile Picture

Aayush Tiwari 221

#3
Subra Profile Picture

Subra 166 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans