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, ...
Suggested Answer

Data Entity Export failing: Cannot create a record in staging table, The record Already exists.

(1) ShareShare
ReportReport
Posted on by 209
Hi Community Experts,

I have one custom data entity which has multiple data sources. I have recently added one more data source to apply a Range and afterwards the entity is failing in DMF export project.





Now when I try to use this Entity in a DMF export project (Excel as output format) it is giving following error for around 60+ positions




I have tried the following to solve this issue:
  1. Regenerated the staging table
  2. Checked the index on staging table, its also intact.
  3. Restarted the AOS service.
  4. Full build/Sync the model.
  5. Ran the following query on data entity to check for duplicates
    SELECT TOP 1 COUNT(RECID) AS KEYCOUNT
    FROM HRORGCHARTEXPORTENTITY
    GROUP BY POSITIONID
None has worked so far.

Looking forward to helpful responses on this issue.
 
I have the same question (0)
  • Suggested answer
    Jonas "Jones" Melgaard Profile Picture
    5,010 Most Valuable Professional on at
    Hi alinawaz,
     
    You can skip staging, but it's not a good solution to your problem.

    Ideally you should identify why there is an index issue (I.e. is the primary index of your staging table identical to that of the data entity etc).
  • Suggested answer
    Jonas "Jones" Melgaard Profile Picture
    5,010 Most Valuable Professional on at
    You have added more information to the question, so it makes more sense now. (-:
     
    You need to change the JoinMode of HcmPositionDuration to ExistsJoin from InnerJoin. If you have more durations, it will duplicate records.
  • alinawaz Profile Picture
    209 on at
    Hi Jonas,
     
    Can not skip staging as their is code written on PostLoad method.

     
    And here's the index situation for entity and staging table

     
     
  • Jonas "Jones" Melgaard Profile Picture
    5,010 Most Valuable Professional on at
    Yep, I added another suggestion (-:
    Think the community board had an issue, could not see the text of your question.
     
    But definitely something to do with the join mode of the datasource you added. It needs to be a binary join (ExistsJoin).
  • alinawaz Profile Picture
    209 on at
    Changed the join mode of the datasource (HcmPosition). Now its not building.
     
  • Suggested answer
    Jonas "Jones" Melgaard Profile Picture
    5,010 Most Valuable Professional on at
    Okay, you are using fields from the joined table, based on the error message.
    Then you just need to add the "ValidFrom" and "ValidTo" fields to the index of the staging table and keep the join mode as InnerJoin. Otherwise you will get index conflicts.
  • alinawaz Profile Picture
    209 on at
    I actually don't need those fields in the field list. I had to add them in the Field list of data entity because without having those fields in the list the entity was not building and errors were present. So after I re-generated the staging table these fields came in the staging table too.
     
    Now adding the fields in index of staging table only and changing the join mode back to "InnerJoin".
    Lets see if this builds and Syncs , and afterward I will try to export entity again.
  • alinawaz Profile Picture
    209 on at
    The problem stands still.
    It is failing while exporting.
     
  • Jonas "Jones" Melgaard Profile Picture
    5,010 Most Valuable Professional on at
    Hmm... That's interesting.
    Unless other chip in, I'd have a look at the data in the view that F&O generated for the entity, and see if there is any index conflicts for the positions it's complaining about.
     
    These are some of the views F&O generates in the standard application for entities.
     
     
  • Suggested answer
    Waed Ayyad Profile Picture
    9,098 Super User 2026 Season 1 on at
    Hi,
     
    What is the relationship with HcmPositionWorkerAssignment table? 
     
     
     
    Thanks,
    Waed Ayyad

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 689

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 455 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 308 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans