About Me

Saturday, March 18, 2017

D365O - Import CSV data through Data entity

Data entity is a new concept comes with D365O release where each entity related data can be accessed from a single view.A data entity is an abstraction from the physical implementation of database tables. For example, customer related data is stored in different tables in AX which could be customer address (access fromLogisticsPostalAddress), customer name (access from DirPartyTable), and customer electronic address (access from LogisticsElectronicAddress).Complete details are well explained here https://ax.help.dynamics.com/en/wiki/data-entities/Let's create new data entity to import data from a CSV file, this data entity uses only one table to keep it simple. My following posts will show how to import data into through data entities using multiple tables.Create a new table [Optional step]I created a new table for this example.

Create new data entityMethod 1:

Method 2:Add new item for Data entity

Provide table as primary datasource

Click Next and mark convert labels to field names

Data entity will look like this in Visual Studio

With both above methods (whatever you choose) it created few artifacts in your project.- data entity- security privileges- staging table

Build your projectPress Ctrl + Shift + B or Right click on project and BuildSynchronize your tables by Right click on project and SyncValidate staging table propertiesSet the configuration key to DMF and all other properties should be same as set below.

Provide a name, choose data source as CSV, and select entity name from the list. Upload file to import.My sample file has this data101, Faisal102, Fareed103, Mohammad

It prompts with fields mapping error

Click on View map and connect fields as shown

Refresh page to view this screen and click Run project.

Follow next few prompts and execute the batch job to import data into the staging table, verify data in the staging table. Import data into the target which will change the transfer status to completed.

Open DataImport data from table browser to see data.This data entity creates view in SQL server, you can even play around with the created view in SQL server.