Extending your DataVerse Sync in Business Central

Extending your DataVerse Sync in Business Central

In Business Central you have two ways of sync your data to Dataverse:

  1. Virtual Entities
  2. Sync

With the Virtual Entities your data stays in Business Central and it is just creating a “look throught” in Datavers. You have to create an API and install the Virtual Entities app in Dataverse and set it up. Then you are ready. This feature is only working for Business Central Online.

The sync is a little bit different. Your data will be synced in Dataverse and stays there. There a allot of great walkthought how you can setup the connection and sync your own tables:
Customizing an Integration with Microsoft Dataverse – Business Central | Microsoft Docs

But last week I discovered that you can also extend existing tables in Dataverse.

For example “Solution 1” has created a integration with the customer table. They have provided the following fields:
– First Name
– Last Name
– Name
– No

(see the red fields in the picture below)

But you want also sync the field address to Dataverse. Without creating a different table and integration.

Well that is possible 😊.

First you have to add the field in Dataverse (see the green field in picture above).
After you have done that you can run the tool “altpgen.exe”:

altpgen.exe 
-project:"C:\Users\bverbeek\Documents\AL\Dataverse1" 
-packagecachepath:"C:\Users\bverbeek\Documents\AL\Dataverse1\.alpackages" 
-serviceuri:"https://org13abfcc3.crm4.dynamics.com" 
-entities:new_employee,systemuser,team 
-baseid:5200 
-tabletype:CDS

You put the excisting entity that you want to create and it will create an table extension for you:

So now you have got your table extension. Now jsut create a page extension to show your field in Business Central:

And create a codeunit to map the original address field to the Dataverse address field:

Just publish the app and that is all 😊.

If you have published your app go to your Business Central tenant and hit the “Use Defaults Synchronisation Setup” and look into the field mapping:

If you run the synchronisation again and you lookup the coupling record you will see also your extra field:

And in Dataverse:

And in Business Central:

So now you can add also your extended fields to excisting Dataverse tables from a solution!

The code you can find here:
Bertverbeek4PS/DataverseExt (github.com)

1 COMMENT

Leave a Reply

Your email address will not be published.