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 :

Data Entity for Table with no Natural Key

Sneha Daggubati Profile Picture Sneha Daggubati

This Blogpost is to help D365 F&O developers create a custom Data Entity on a Table that has no Natural Key and how to resolve the issue and move forward with Datas Entity creation. 

  1. Create a new Model

A model is a group of elements, such as metadata and source files, that typically constitute a distributable software solution and includes customizations of an existing solution.

 

A model always belongs to a package. A package is a deployment and compilation unit of one or more models. It includes model metadata, binaries, and other associated resources. One or more packages can be packaged into a deployable package, which is the vehicle used for deployment on runtime environments.

To create a new model, in Visual Studio – from the menu, click on the Dynamics 365 >> Model Management >> Create model. This will open the model wizard.

1323.DE1.png

 From the model wizard, specify the Model name, Model Publisher, Layer, Version, Model description, and Model display name.

7573.DE2.png

Click Next, chose Create new package.

 1663.DE3.png

Click Next, Chose the 3 essential packages below:

  • The Application Platform interfaces to kernel functionalities that are application logic agnostic. The AOS can be started with just this model. It includes concepts like AIF base objects, Batch, Form base objects, RunbaseSysOperations* base objects, Appl, Info, Global, ClassFactory, ENUM/EDT/Macros/ConfigKey/LicenseCode.
  • The Application foundation features include Dimension framework, Global Address Book, Number Sequence, OrgModel, Business Intelligence, Reports, Upgrade framework, Security, E-Signature, Data Import/Export, Workflow
  • The Application Suite includes Supply Chain Management, Human Capital Management, Professional Services, etc.

 4743.DE4.png

 Click Next, Review the Summary and Click on Finish to complete the Model creation.

  

  1. Create a Project in the model created above.

Next you are prompted to give a name for the new project being created associated with your new model. 

Choose Finance and Operations as project Type, Enter Project Name nd Click OK.

 3730.DE5.png

New solution with the project gets created and note the following:

 

1172.DE6.png 

 

  1. Create new Data Entity in the Project

Right click on Project in the solution Explorer, click on Add, New Item.

 0523.DE7.png

 In the form that opens, under Data Model, we select the Data Entity element type. Enter DataEntity Name. Be careful when you name the entity because you can’t rename it later.

3247.DE8.png

Next, in the Data Entity wizard, we select the appropriate primary data source. For our scenario, this data source is VendInvoiceTrans.

1680.DE9.png

Click Next.

The wizard doesn’t accept tables that don’t have a natural key, as is the case with VendInvoiceTrans. Therefore, we receive the following error message.

5857.DE10.png

The workaround is to select any other primary data source that has a natural key associated, such as VendTable/VendGroup. Because we don’t really need this data source, we also don’t need any fields for it. Therefore, we clear the Select all check box.

8484.DE11.png

We create the template for our entity by clicking Finish.

 

  1. Customize the Data Entity

The entity, staging table, and security assets have been created, and we can now produce our custom entity. In the project, we open the VendorInvoiceTransactionDetailsEntity entity in the designer. In the designer, we replace the dummy table (VendTable/vendGroup) that we applied in the wizard with the transaction table VendInvoiceTrans. Because we didn't choose to add the fields, we don't have to remove fields in the entity.

Change Data source from “VendTable” to “VendInvoiceTrans”.

 2642.DE12.png

Drag and drop fields into Data Entity fields, make sure RecId of ’VendInvoiceTrans’ is included in data Entity fields. After the field is in the field list, we can drag it to the EntityKey node in Data Entity.

 5722.DE13.png

To make sure that the staging table is associated with the fully configured entity, we must update it. On the context menu for the entity, we select Update staging table.

Build your Model and Synchronize DB, Refresh Entity List in DM workspace. Then you should be able to find your entity in DM workspace.

 4274.DE14.png

If you come across Warnings like the following:

Warning: BP Rule: [BPUpgradeMetadataEDTRelation]:EDT relation found in field ItemId of table inventTransExportStaging. It should be migrated to a regular table relation.

Resolution: Review your staging table, set "Ignore EDT relation" property on the field to Yes on the fields , Create a relation on the staging table. Eg: ProjectItemJournalTransStaging Table ItemId field.

Comments

*This post is locked for comments