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

A valid primary key was not found on the staging table for this entity ,Entity 'Packing slip' doesn't have primary or unique key. Staging table '' needs to be altered.

(0) ShareShare
ReportReport
Posted on by 476

Hi Team,
I am getting warning while adding composite entity to export project.
I have created one header entity from CustPackingSlipJour table and another line entity from CustPackingSlipTrans. Refer below screen shot.

pastedimage1676527844742v3.png                        pastedimage1676527757950v2.png  


Created composite entity using above 2 entity.
pastedimage1676527978628v4.png

Staging table alos updated and index already created.

Geting below warning while export.
pastedimage1676528125082v6.png

Please suggest the solution.

I have the same question (0)
  • Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    The error message talks about staging table, but you didn't show us staging table at all, just entities.

    Also, shouldn't the relation use the entity key of the header entity?

  • Vijay Yelmame VY Profile Picture
    476 on at

    Hi Martin,

    Thank you for the quick reply.

    Please find below screen shot for staging tables. 
    pastedimage1676529567102v1.png  pastedimage1676529619266v2.png

    you mean i need to use the entity key of header entity in the relation with line entity ?

  • Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    The error message says that there is no primary or unique key. Please look at it; you didn't mention nor show anytthing on this topic.

    Yes, it looks very strange that you define an entity key and then ignore it and use completely different fields that aren't used in any unique key. The purpose of the entity key is uniquelly identify an entity record and you need the same thing in the relation. Ambigious relations are dangerous.

  • Vijay Yelmame VY Profile Picture
    476 on at

    Hi Martin,
    Thank you for the information given for the entity key.

    The relation between 2 data sources is below so that I have created same relation on my line entity and the key are added on the entity are the primary key of their respective data sources.
    pastedimage1676531682858v1.png

    Now i have changed as below but getting same error. I have kept entity refresh i will check once again, but please correct me if i did anything wrong.
    pastedimage1676533304803v3.png 

    staging table
    pastedimage1676533575720v4.png

  • Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    You keep ignoring what the error message actual talks about: indexes.

    If you want to identify the header entity by SalesId, PackingSlipId and DeliveryDate, then why don't have these fields in the entity key?

  • Vijay Yelmame VY Profile Picture
    476 on at

    Hi Martin,

    I have added above mention fields in entity already.

    for header entity

    PackingSlipId

    salesId

    DeliveryDate

    CustPackingSlipJourRecId - (Primary index of CustPackingSlipJour)

    for Line entity

    PackingSlipId

    OrigSalesId

    DeliveryDate

    CustPackingSlipTransRecId (primary index of CustPackingSlipTrans)

    On staging as well it is generated. but still i am not able to understand where you exactly telling me to add the above mentioned fields.
    pastedimage1676535621001v1.pngpastedimage1676535767694v2.png

  • Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    I'm just saying that the relation should match the entity key.

    The error is about an index on a staging table.

  • Vijay Yelmame VY Profile Picture
    476 on at

    HI Martin,
    I have debugged the code and found below from DMFQuickImportExportFormHelper::validateEntityV2() 
    pastedimage1676551408441v3.png

    pastedimage1676550958516v1.png


    It is always return false for composite entity because there is no EntityTable set for any composite entity(including standard entities).

    pastedimage1676551048677v2.png



    Thank you for all the help.



  • Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    That's a for different thing - a validation of the entity. The validation this thread is about (index of staging table) seems to be in DMFEntity.verifyStagingPrimaryKey().

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 611 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans