AL Table Proxy Generator
Effective November 2020:
The AL Table Proxy Generator tool can be used to generate one or more tables for integration with Microsoft Dataverse. When one or more tables are present in Microsoft Dataverse, but not in Dynamics 365 Business Central, the tool can be run to generate integration or proxy tables for the specified table or tables.
An integration or proxy table is a table that represents a table in Microsoft Dataverse. The integration table includes fields that correspond to columns in the Microsoft Dataverse table. The integration table acts as a link or connector between the Business Central table and the Microsoft Dataverse table.
Microsoft Dataverse and Business Central store dates in different formats. In Business Central, all users see the same date across all time zones, whereas Microsoft Dataverse-based apps render the dates based on the current user's time zone.
The AL Table Proxy Generator tool does not support time zones for dates and converts dates from Microsoft Dataverse to the Business Central format.
The AL Table Proxy Generator tool is available with the AL Language extension. Look for the altpgen.exe tool in the equivalent folder of
c:\users\<username>\.vscode\extensions\<al extension version>\bin.
Generating proxy tables
- Start Windows PowerShell as an administrator.
- From the command prompt, write
.\altpgen.exefollowed by the parameters as described below.
-Project -PackageCachePath -ServiceURI -Entities -BaseId -[TableType]
- The table or tables are generated in the folder of the specified AL project.
|Project||The AL project folder to create the table(s) in.|
|PackageCachePath||The AL project cache folder for symbols.
Note: It is important that the latest symbols have been downloaded because these are used for comparison when the tool runs.
|ServiceURI||The server URL for Microsoft Dataverse. For example,
|Entities||The table(s) to create in AL. If multiple, this must be specified as a comma-separated list.
Note: It is important that all related tables are specified too. Related tables are, for example, used for lookups and if the related tables are not found, a lookup will no longer be working. For more information, see the section Specifying tables.
|BaseId||The assigned starting ID for the generated new table(s) in AL.|
|TableType||The table type for the table(s) in AL. The options are
Note: If unspecified, the system looks both for
Entities parameter specifies the logical names of the table(s) to create in AL. To know which ones to specify you need to check the main table relationships in Microsoft Dataverse. For more information, see Table relationships overview. You specify all tables that you want created, including the related tables, in the
Entities parameter separated by commas.
An example could be, that you want to generate an AL proxy table for the CDS Worker Address (cdm_workeraddress).
If you run the altpgen tool and only specify
cdm_workeraddress, the tool will not generate the
Worker lookup field, because no related table
Worker is specified.
If you, in the
Entities parameter specify
cdm_workeraddress, cdm_worker, the
Worker lookup field will be generated. Furthermore, if your symbols contain the
cdm_worker table definition, the
Worker table will not be created as it's already in your symbols. If your symbols do not contain the
cdm_worker table, the
Worker table will be created together with the
Worker Address table.
Creating a new integration table
The following example starts the process for creating a new integration table in the specified AL project. When complete, the output path contains the Worker.al file that contains the description of the 50000 CDS Worker integration table. This table is set to the table type CDS.
.\altpgen -project:"C:\myprojectpath" -packagecachepath:"C:\mypackagepath" -serviceuri:"https://tenant.crm.dynamics.com" -entities:cdm_worker,cdm_workeraddress -baseid:50000 -tabletype:CDS