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

Export is failing in composite data entities

(0) ShareShare
ReportReport
Posted on by 152

Hi,

I have created a composite data entity using the following link: https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/data-entities/develop-composite-data-entities

Importing composite entities is working fine, when I am trying to export it is showing an error "cannot create a record. The record already exists in the data entity."

I have two tables 

Table1:

Fields: Rollnumber  (Primary index)

            Name

Table2:

Fields: Rollnumber (Primaryindex)

            TotalMarks

Table1 and Table2 are related by the field Rollnumber using normal relation.

Could anyone help me with this.

Thanks,

Nithin  

I have the same question (0)
  • Sergei Minozhenko Profile Picture
    23,095 on at

    Hi,

    Most likely you have an issue with StagingIdx index for table2 staging table. Is the relation between Table1 and table2 done as one-to-many?

  • Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at

    Are you sure it's about export? Export shouldn't write anything to entities; that's what import does.

    Isn't it possible that the message is correct; that you already have records in database with the same Rollnumber?

    Do your entities work correctly if you use them directly, not though a composite entity?

  • nithinkumar_007 Profile Picture
    152 on at

    Hi Martin,

    Sorry the error message is "Cannot create a record in Studentsubjectdetails_nitStaging (Table2)(Studentsubjectdetails_nitStaging). The record already exists."

    The entities are working correctly if I use them directly.

    Please refer to the below screenshot

    pastedimage1583402437250v1.png

    Thanks,

    Nithin.

  • Suggested answer
    Rahul Mohta Profile Picture
    21,042 on at

    is this export to BYOD?

    check target data and data being exported for their primary key violation and suggest

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,095 on at

    Hi Nithin,

    When you export data through composite entity data is exported to staging tables first.

    First, you need to check if unique indexes on staging tables (Studentsubjectdetails_nitStaging) are made correctly.

    I suspect that you have a StagingIdx index for table Studentsubjectdetails_nitStaging with only RollNumber field (in addition to DefinitionGroup and ExecutionId) and you need to add more fields to make it unique, for instance, subjectId or check the list of fields from the unique index for source table (Studentsubjectdetails_nit).

  • nithinkumar_007 Profile Picture
    152 on at

    Hi Sergei,

    I have adding Linenumber in stagingIdx for table StudentSubjectdetails_nitStaging, it is showing the same error.

    Thanks,

    Nithin.

  • Sergei Minozhenko Profile Picture
    23,095 on at

    Hi,

    Do you have other unique indexes on StudentSubjectdetails_nitStaging table? It would be helpful if you could share the list of unique indexes and fields in it.

  • nithinkumar_007 Profile Picture
    152 on at

    Hi Sergei,

    Please find the below screenshot which contains the details of the table

    pastedimage1583920124103v2.png

    Thanks,

    Nithin.

  • Sergei Minozhenko Profile Picture
    23,095 on at

    Hi Nithin,

    Are you sure you don't have duplicates by RollNumber and LineId in StudentSubjectdetails_nit table?

  • nithinkumar_007 Profile Picture
    152 on at

    Hi Sergei,

    The table StudentSubjectdetails_nit has only two records which I imported from the following XML file.

    pastedimage1583922030110v1.png

    The records in the table StudentSubjectdetails_nit are as shown

    pastedimage1583922112957v2.png

    Thanks,

    Nithin.

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 658

#2
André Arnaud de Calavon Profile Picture

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

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 333 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans