Tag Archives: D365 fins and ops data entity

D365 FO/AX7: Composite Data Entities Vs Data Entities With Example

  • Introduction – Data management framework of Microsoft Dynamics 365 finance and operations contains a very important technical asset called Data Entities. Data entities are conceptual combinations, abstraction and encapsulation of one of more underlying tables. Data entities in Microsoft D365 finance and operations are used to import and export data in Microsoft Dynamics finance and operations. Odata integration can also be achieved using D365 finance and operations data entities. We can customize standard data entity . Click Here to know about standard data entity customization.
  • Composite Data entity vs Simple Data Entity- There are some differences between Composite Data entity & Simple Data Entity. 1 ) First of all simple data entity contains one or more tables where as composite data entity contains multiple data entities 2) Simple Data entities support Odata & can be used in Odata integration whereas Composite data entities cannot be used Odata integration.
  • Where should we use Composite Data entity ?-Composite entity is used in scenarios where an entity can be represented as a single document, like Purchase Header/line , Sales header/line, Invoice header/line etc.
  • Example & Development of Composite Data entity steps are mentioned below :
  • In example i am taking 2 separate standard data entities i.e. PurchPurchaseOrderHeaderV2Entity & PurchPurchaseOrderLineV2Entity
  • PurchPurchaseOrderHeaderV2Entity contains purchase order header information & fields mainly purchTable Fields
  • PurchPurchaseOrderLineV2Entity contains purchase order Lines information & fields mainly PurchLine Fields
  • We will develop a new composite data entity by using above 2 data entities and compose data entity will represent a single purchase order document (Purchase Order Header + Purchase Order Line)
  • Now create a composite data entity in your project.
  • Extend PurchPurchaseOrderLineV2Entity and create relation with PurchPurchaseOrderHeaderV2Entity. (NOTE In my case standard relation is already there so no need to create any customize relation)
  • Right click on your composite data entity and add “New Root Data Entity Reference” and make sure property Data Entity should be equal to PurchPurchaseOrderHeaderV2Entity
  • Right click on your “New Root Data Entity Reference” PurchPurchaseOrderHeaderV2Entity and add “New Embedded Data Entity Reference” equals to PurchPurchaseOrderLineV2Entity & Property Relation should be equal to PurchaseOrderHeader.
  • Extend staging table (PurchPurchaseOrderLineV2Staging) of data entity PurchPurchaseOrderLineV2Entity and add relation with the staging table (PurchPurchaseOrderHeaderV2Staging) of data entity PurchPurchaseOrderHeaderV2Entity.(NOTE : In my case standard relation already exist so i am not creating any relation)
  • Add two columns, RowId and ParentRowId (type int), on all the staging tables i.e. PurchPurchaseOrderHeaderV2Staging & PurchPurchaseOrderLineV2Staging.
  • Create a cluster index on the staging tables which includes RowId, ParentRowid,DefinitionGroup, and ExecutionId for getting good performance .
  • Build and synchronize your project
  • Under “Data import/export framework parameters”, select fast tab “Entity Settings” and click on “Refresh Entity List”. Here is LINK AND TUTORIAL.

D365 FO/AX7: The natural key for the table XXXX was not found [Solved] Data Entity Error

  • Issue – During the creation of data entity of table VendInvoiceTrans in Microsoft Dynamics 365 Finance and operation, system is throwing error- The natural key for the table VendInvoiceTrans was not found.
  • Root Cause The reason is that the table VendInvoiceTrans is using  RecId as its primary index. D365 Fo Data Entity Wizard doesn’t support tables with a RecId as a primary index.
  • Steps to Solve
  • Duplicate any existing data entity in your D365 fins and ops project and model. In my case i am making a duplicate copy of existing data entity – EMPSurveyTableEntity
  • Rename the duplicate copy of data entity
  • Change the existing datasource of data entity from EMPSurveyTable to VendInvoiceTrans
  • Delete existing fields of data entity and add new field from datasource vendInvoiceTrans
  • Remove the field from KEYS –> ENTITY KEY and new fields as per your need from datasource VendInvoiceTrans. ENTITY KEY fields should not allow duplicate and should be unique combination.
  • Change the Data entity properties PUBLIC COLLECTION NAME , PUBLIC ENTITY NAME & DATA MANAGEMENT STAGING TABLE to new values.
  • Right click on data entity and regenerate Staging Table Again
  • Assign data entity to security privilege.
  • Rebuild and synchronize the project .