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

Notifications

Announcements

No record found.

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
    4,926 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
    4,926 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
    4,926 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
    4,926 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
    4,926 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,039 Super User 2025 Season 2 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 522 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans