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, ...
Answered

BYOD Export: Cannot Create a record in Inventory transactions originator (InventTransStaging)... The record already exists

(0) ShareShare
ReportReport
Posted on by 99

Hello, 

Let me preface by saying I am a novice at best when it comes to D365FO, and exporting to our Azure SQL DB. I will try and be as thorough as possible. 

I am currently attempting to export the entity 'Inventory transactions originator', which I can verify has data within it when utilizing an Odata.Feed with Power BI. 

I am receiving the following errors when attempting to BYOD export this entity to our Azure SQL DB:

Cannot create a record in Inventory transactions originator (InventTransStaging). Reference: Sales order. The record already exists
Cannot create a record in Inventory transactions originator (InventTransStaging). Reference: Transfer. The record already exists
Cannot create a record in Inventory transactions originator (InventTransStaging). Reference: Counting. The record already exists
Cannot create a record in Inventory transactions originator (InventTransStaging). Reference: Purchase order. The record already exists
Cannot create a record in Inventory transactions originator (InventTransStaging). Reference: Transaction. The record already exists
Cannot create a record in Inventory transactions originator (InventTransStaging). Reference: Transfer order shipment. The record already exists
Cannot create a record in Inventory transactions originator (InventTransStaging). Reference: Transfer order receive. The record already exists
Cannot create a record in Inventory transactions originator (InventTransStaging). Reference: Project. The record already exists
Cannot create a record in Inventory transactions originator (InventTransStaging). Reference: Inventory adjustment. The record already exists

These are the summary of the errors received, I received multiple of each of the above listed.

Again, I can see the entity contains data when utilizing an Odata.Feed within Power BI, so not sure where the issue is occurring. 

Any idea what could be causing this issue? 

I have the same question (0)
  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Zach Robinson,

    It looks like you are using a customized entity to export data. Please check the entity key defined and if there are any duplicate records (as per the entity key).

  • zachary.robinson@gtl.net Profile Picture
    99 on at

    Gunjan, thank you very much for your response.

    And, yes, I am utilizing a custom entity. How would I check the entity key that is defined?

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Zach,

    If you go to your custom entity, you should be able to check the entity key. For an example you can check the screenshot here.

    pastedimage1614719003387v1.png

  • zachary.robinson@gtl.net Profile Picture
    99 on at

    Thank you Gunjan, 

    Below is a screenshot of the custom entity:

    pastedimage1614719524014v1.png

    I am not seeing anything listed under EntityKey. Is there supposed to be something listed here? If so, what should be listed here?

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Zach,

    The entity key uniquely identifies a record of the data entity. You can check this link for details. Looking at the screenshot, you might try setting a combination of these fields-  InventTransId, InventDimId, RecId (from InventTrans) as the Entity key for this entity and check if that works. You will need to make sure that the fields exist in the data entity so that you can add them as an Entity key.

  • zachary.robinson@gtl.net Profile Picture
    99 on at

    Thank you for that.

    I have added InventTransId (from InventTransOrigin), InventdimId (from InventDim), and RecId/RecId1 (from InventTrans, the Datafield property says it is called RecId, and the Name property says it is RecId1).

    pastedimage1614721924308v1.png

    I have rebuilt the project and synchronized to database. What is the best way to ensure that this entity will work for export prior to me promoting this up to Production, and having to start over again? Is there a way to check if this will work in the dev environment first before requesting promotion?

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Zach,

    What I would normally do is to check the view created for the entity in the SQL DB and look for any duplicates there based on the fields in the Entity key. You should have a view named dbo.InventTransEntity_V1. You need to regenerate the staging table as well.

  • zachary.robinson@gtl.net Profile Picture
    99 on at

    Thank you Gunjan. Regarding the staging table, in my previous edit of this entity recently, I had done a refresh/update of the staging table, and am not seeing that option available when I right-click on my project.

    pastedimage1614724359216v1.png

    In Sql Server Managment Studio, on my initial query in of the custom entity/view that I created, InventTransEntity_v1, there are duplicates listed for the InventTransId.

    pastedimage1614724507503v2.png

    The same query with RecId1 did not show any duplicates.

    What should my next steps be?

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Zach,

    You should open the data entity in the designer, right click and regenerate staging table.

    pastedimage1614724839469v1.png

    In the Sql query, you should add the other two fields in the entity key to the group by clause as well and check for duplicates.

  • zachary.robinson@gtl.net Profile Picture
    99 on at

    Thank you for that!

    I have regenerated the staging table on my end, I was looking in the wrong place.

    I also updated the query to reflect the three entitykeys together, and found no duplicates when all 3 are together, is this correct?

    pastedimage1614725502038v1.png

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
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 420 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 241 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans