編集

次の方法で共有


AL Table Proxy Generator

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.

Note

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

  1. Start Windows PowerShell as an administrator.
  2. From the command prompt, write .\altpgen.exe followed by the parameters as described below.
    -Project
    -PackageCachePath
    -ServiceUri
    -ClientId
    -RedirectUri
    -Entities
    -BaseId
    -[TableType]
    
  3. The table or tables are generated in the folder of the specified AL project.

Parameters

Parameter Description
Project The AL project folder to create the table(s) in.
PackageCachePath The AL project cache folder for symbols.
Note: It's 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, https://tenant.crm.dynamics.com.
ClientId The client ID for Microsoft Entra application.
RedirectUri The redirect URI for Microsoft Entra application.
Entities The table(s) to create in AL. If multiple, this must be specified as a comma-separated list.

Note: It's important that all related tables are specified too. Related tables are, for example, used for lookups and if the related tables aren't 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 CDS and CRM.

Note: If unspecified, the system looks both for CDS and CRM tables.

Specifying tables

The 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 won't generate the Worker lookup field, because no related table Worker is specified.

If you specify cdm_workeraddress, cdm_worker in the Entities parameter, the Worker lookup field is generated. Furthermore, if your symbols contain the cdm_worker table definition, the Worker table won't be created as it's already in your symbols. If your symbols don't 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" -clientid:00001111-aaaa-2222-bbbb-3333cccc4444 -redirecturi:"https://localhost:8080" -entities:cdm_worker,cdm_workeraddress -baseid:50000 -tabletype:CDS 

Authentication

Users are required to register a Microsoft Entra application and provide its client ID and redirect URI as arguments when running the tool. To register an application, sign in to the Microsoft Entra admin center as a Cloud Application Administrator. The application must have the user_impersonation permission for Dynamics CRM API. The Redirect URI type must be **Public client/native (mobile & desktop).

See also

Overview - integrating Business Central with Microsoft Dataverse
Custom integration with Microsoft Dataverse