In my last blog post, I described how you can easily set up Dynamics 365 Business Central and Microsoft Dataverse integration.
With this blog post will show you how you can utilize that integration and build your own custom entity.
In my case, I built one simple Dynamics 365 Business Central table for storing records about vehicles.
The first step was to create a table where I will store data inside Dynamics 365 Business Central.
This is a simple table with PlateNumber as a Primary key and a few standard fields like Vehicle Model and submodel, Vehicle type, and a number of seats.
The second step is to create a page that I will use to insert records into the table. For that step, I used List page type.
The third step was to create an API page type that I will use to expose my table data to Microsoft Dataverse.
In the API page type, it is very important to specify the following:
- APIPublisher – publisher of the API endpoint. I like to use my name or organization name.
- APIGroup – a group of the API endpoints. I like to use purpose of the API.
- APIVersion – specify the version of the API. For Microsoft Dataverse virtual entity, the supported version must be 2.0.
- EntityName – singular entity name.
- EntitySetName – plural entity name.
- ODataKeyFields = SystemID – SystemID will make sure that each record in your table has unique value -> GUID.
The final step in VS Code is to create an XML file that will automatically create a web service inside Dynamics 365 Business Central. With Web service, I will publish my API page.
When I publish an extension in Dynamics 365 Business Central, I will find the Vehicle List page to enter data.
Also, in Web Service, I will find the API page published as a web service.
Now I have everything ready inside the Dynamics 365 Business Central, and next is to navigate to make.powerapps.com.
In the list of tables, I will find the Available Business Central Table and open the table.
In the Data, I will find my Dynamics 365 Business Central table.
Pay attention to the
- Display Name
- API Route
Those are all the values inherited from the extension.
The next step is to click Edit record in the upper left corner.
In the new window, enter the checkmark in the field Visible and click Save and Close.
In few seconds, I will find my table published as a virtual entity in Microsoft Dataverse.
When I open the dvVehicleAPI table and click Data, I will find my Dynamics 365 Business Central Data.
In this way, I successfully published my custom Dynamics 365 Business Central table as Microsoft Dataverse virtual entity.
As a final demo, I will build a Power Apps Model-Driven application to control data in Microsoft Dynamics virtual entity.
To start, I will navigate to Apps -> + New app -> Model-Driven
In the new screen, I will specify the app Name, description, and click Done.
In a few seconds, I will see App Designer, and here I must define Site Map by clicking on the pencil icon.
Now, I will select New Area and on the right side, I will choose Properties. In the Title (1033) field I will enter the area title, and in the ID field, I will enter the area ID.
Now, I will select New Group and on the right side, I will choose Properties. In the Title (1033) field I will enter the group title, and in the ID field, I will enter the group ID.
Now, I will select New Subarea and on the right side, I will choose Properties. In the Type field, I will choose Entity. In the Entity field, I will find my dvVehicleAPI entity. In the ID field, I will specify a unique name for the Subarea. As a final step, I will click Save And Close.
Now, when I have a site map, all I need is to customize one form so my user can enter the data. This I will do from the App Designer and by selecting Forms and then edit the Information form.
In the new screen that opens I will click on Table columns, choose columns that I want to see on my form and drag and drop to the canvas. After that I need to click Save and Publish the changes.
In the end close the screen, return to the App Designer and click Save and then Publish.
Now to test the app click Play and the data from Microsoft Dataverse virtual entity will show.
If you click +New, the new form will open where you can enter the data.
After you click Save & Close, data will be visible inside Microsoft Dataverse virtual entity and the Dynamics 365 Business Central.
That’s it for now and for this blog post.
I hope you will find it useful.
In my next blog post, I will continue to use my custom API and try some new features like enum and how to use this custom API with the Postman.
Renato 🙂Tags: Common Data Service Dataverse Dynamics 365 Business Central Power App PowerApps