Every organization hasย custom data that is specific to their operations/process. Most organizations see tremendous value in bringing over that data to work with your enterprise software system either interactively for transactions or use for reports/dashboards. Microsoft Dynamics 365 Finance and Operations has provided a Data Management Framework (DMF), that allows for the D365 system to be that one fully-integrated & all-encompassing system. We will walk through Data Management Framework of Dynamics 365 Finance & Operations. Data Management & Data Entity Data Management Framework of Microsoft Dynamics 365 for Finance and Operations utilizes data entities in Data migration Copy module setups and configurations Integrations In this example, we will see how data is imported through Data entity from an Excel file. Figure 1. Data Management in Dynamics 365 for Finance and Operations Sample Scenario D365 Finance & Operations allows for adding fields to existing Data entities, so most custom data can be included within that entity. For the sake of explaining the programming concept, we will create a new entity which is related to the existing master data entity, say Customer. There are many scenarios where users bring data from external systems and import into D365 on a daily/weekly basis. Figure 2. Sample excel data The user will make a list of customer accounts available, in an excel file, and then import that file in Dynamics 365 for Finance and Operations using theย Data management workspaceย through aย Data Entity. During the import, the system will find the related record of customer account in Customer master and store its record Id (CustTable.RecId) into a new tableย ASCCustRelatedTable as well as monthly account balance (and any other custom data fields). In case of any exception, user would able to view the error or warning details in the log of the Data management module. Building the solution First, we will create a tableย ASCCustRelatedTableย with all the required fields and index where we store the values ofย CustTable.RecIdย during the time of import from excel. In our case, we have fields and index as mentioned here Figure 3. ASCCustRelatedTable structure Figure 4. View of ASCCustRelatedTable in the development window After creating the tableย ASCCustRelatedTable, we would be creating a data entity. For this we must right click on the table and go toย Add-ins, then click onย Create data entity. By doing this, new data entityย ASCCustRelatedTableEntityalong with some dependent security privilege objects. Figure 5. Creating new entity from ASCCustRelatedTable Figure 6. New entity and security objects from ASCCustRelatedTable The user will only import an excel file that contains a list of customer account, but we require to store the record Id of Customer master (CustTable.RecId) into a separate tableย ASCCustRelatedTable as well as monthly account balance. To achieve this, we must create a new classย ASCCustRelatedTableEntityEventsย and subscribeย MappingEntityToDataSourceย event of data entityย ASCCustRelatedTableEntity. We would be initializing the value ofย CustTableRecIdย andย MABย fields through thisย MappingEntityToDataSourceevent which would be executed during the time of excel import. Here is how the assignment would be CustTableRecId = CustTable.RecId MAB = CustTable.BalanceCurrency() We can change and utilize the event as per your need and business scenarios. Figure 7. Assigning values to the fields of the ASCCustRelatedTable through MappingEntityToDataSource After all these steps, we should build and synchronize our Visual Studio solution. Testing Log in to your Microsoft Dynamics 365 for Finance and Operations environment & open the workspaceย Data management. Click onย Import, choose the data entityย ASCCustRelatedTableEntity and add your source excel file with the list of customers. Figure 8. Data management workspace โ Import This is how the import project looks Figure 9. Data management โ Import project Click onย Importย in the action pane and records will get inserted into the tableย ASCCustRelatedTableย along with the fieldย CustTableRecIdย andย MAB. Figure 10. ASCCustRelatedTable table browser In case of an error, we can refer the log. Figure 11. Data management โ Import projectโs log information
