Data Entity Create Virtual Field – Microsoft Dynamics 365 for Finance and Operations

Requirement is to have a custom field showing Customer Number and Name.
In that case instead of creating regular field on the Data entity and we will create a virtual field and fill the data at runtime when records are importing
Below are the steps needs to perform:
1. Create extension of the base entity (Example SalesOrderHeaderEntity) or your custom entity
2. Open the entity in designer and expand the fields
3. Right click and add new field -> StringUnmappedField
4. Set the Name property  of new field, in our case I put ‘CustomerNumberAndName’
5. Set the IsComputedField Property to No.
6. Leave the DataEntityViewMethod Empty
7.Use the virtual field to receive the information from outside(odata or excel) and parse the information
8. Use chain of command or pre-post event handler if its base entity or customise the method ‘mapEntityToDataSource’
‘example of mapEntityToDataSpurce’
public void mapEntityToDataSource(DataEntityRuntimeContext entityCtx, DataEntityDataSourceRuntimeContext dataSourceCtx)
    next mapEntityToDataSource(entityCtx,dataSourceCtx);
    //Check if desired data source context is available
   switch (
case dataEntityDataSourceStr(SalesOrderHeaderV2Entity, SalesTable):
SalesTable salesTable = _dataSourceCtx.getBuffer();
this.CustomerNumberAndName = salesTable.InvoiceAccount + ‘ – ‘ salesTable.customerName();
10. You can get the value from odata also to use it for different purpose as per request

Data Entity Not available on Powerapps and Power BI ,Dynamics 365 for Finance and Operations

Issue: Data Entity of Dynamics 365 for Finance and Operations is not available on power apps and Power BI


Casue: Data Entity of Dynamics 365 for Finance and operation will not be available if Is Public  property of Data Entity is No


Screen Shot 2019-08-28 at 11.32.49 AM.png


Resolution: Just change the Data Entity Is Public property to Yes