Creating Entity for Natural Key Error on Invent Trans
Data Entity is a new concept which
has been introduced in D365FO and has major use in Data Import/Export and for
Data Integration. Data entities can be regarded as an abstraction from
the physical implementation of database tables. Implemented as de-normalized
views (a data entity is stored as a view in SQL Server) with their own set of
methods, they are now key elements in data import/export and integration
scenarios.
While creating entity for invent trans table, getting natural
key error. Hence duplicated the invent trans and kept for build, but there are
several errors.
Hence created the entity with the datasource as InventTransOrigin
table.
1.
Create
a Project
Solution Explorer > Right click the
Project > Click Add > New Item.
2.
Select
‘Data Entity’ > Place the name for the entity(mentioned as InventTransEntity)
> Click Add
3.
Data
Entity Wizard would pop-out.
4. Select Primary Data source as InventTransOrigin table and entity category as Master and the Public entity name is InventtransEntity and Public collection name is InventTransentities and click on Next.
5. There are 2 check boxes available in the wizard:
Enable API – Check
this if you would like to use this entity for Integration purpose
Enable Data Management capabilities – Check this, if you would like to use this entity for Data Import/Export purpose.
6.
Click next and select the fields which are required,
here select ‘reference Category’, ‘InventTransId’ and ‘itemId’ field and click
on next.
7.
Entity will be generated in the project
with the data source as InventTransOrigin.
8. Add inventTrans table as Data source to InventTrasOrigin. Please check the relations before adding the data source and add fields of inventTrans.
9.
After adding the Data source, in
the properties, select the table as InventTrans.
10. On
the relations node of newly added Data source (InventTrans), click and add a
new relation.
112. Add the fields required for entity from Data source\InventTrans to the Entity Fields.
1314. Add new unmapped fields if required and in properties select ‘IsComputedField’ = NO.
1515. Need
dimension Fields which are present in the InventDim table, will add InventDim
as Data source based on the relation with inventTrans.
16. In
Properties, Provide the table name as InventDim.
17. Set
the relation, by creating a new relation on the newly added data source
(InventDim).
18. Add
Required fields from the data source InventDim to Entity Fields.
19. Add table/InventTableModule as data source to InventtransOrigin, similar like InventTrans.
2021. In order to use the InventDim fields, need to add a mapping in the entity mappings node with the map ‘InventInventoryDimensionEntityFieldsMapping’.
22. Map
the fields in between the entity fields and the InventInventoryDimensinoentity
FieldsMapping as shown below.
The above step is to get the information on the dimension related
fields.
23. Added new Unmapped fields in the entity, in order to populate the data in to those fields,
need to over ride the method ‘postload()’ and populate the values into it.
24. Update the staging table, by right click on the entity and select ‘Update staging table’. 25. Save and build the Project, set the project property ‘Synchronize with DB’ = True.
26. Once
Build succeeded, navigate to Data Management -> framework Parameters -> Entity settings. This will take some time to refresh all
the entities.
27. Go to Data management -> Data entities tile, check for the newly created entity by providing the entity name.
Data
will be populated in the Excel Sheet/Json file.
Comments
Post a Comment