Adding data for Extensions
For your extension to run properly, configuration and starting data such as permission sets and table data may be needed. An extension can include the following types of data that can be imported for the tenant during the installation of the extension.
- Permission sets
- Web services
- Starting table data
- Custom report layouts
The data must be exported into files to be included in the extension. To use the export functions you must use a container sandbox environment for Dynamics 365 Business Central. For more information, see Get started with the Container Sandbox Development Environment.
To add permission sets
Open the Business Central Development Shell.
Export the relevant permission set using the
Export-NAVAppPermissionSet
cmdlet to export the permission set to a file. For example, the following command exports the BASIC permission set.Export-NAVAppPermissionSet -ServerInstance DynamicsNAV160 -Path '.\PermissionSet.xml' -PermissionSetId BASIC
Note
Export each permission set to a separate XML file.
Add the exported permission set files to the Visual Studio Code project that contains your extension.
Warning
If you do not include a permission set with your extension, only users with the SUPER permission set will be able to use the extension.
Important
With the latest version of Dynamics 365 Business Central permissions are no longer defined as data in the application database. Permissions that can be created by using AL objects are called system permissions. For more information, see Entitlements and Permission Sets Overview.
To add web services
Open the Business Central Development Shell.
Export the relevant web service using the
Export-NAVAppTenantWebService
cmdlet to export the web service to a file. The following command exports the Customer Card page.Export-NAVAppTenantWebService -ServerInstance DynamicsNAV160 -Path TenantWebService.xml -ServiceName Customer -ObjectType Page -ObjectId 21
Note
Export each web service to a separate XML file.
Add the exported web services files to the Visual Studio Code project that contains your extension. An exported web service XML file looks like the following:
<?xml version="1.0" encoding="utf-8"?> <ExportedData> <TenantWebServiceCollection> <TenantWebService> <ObjectType>Page</ObjectType> <ObjectID>21</ObjectID> <ServiceName>Customer</ServiceName> <Published>true</Published> </TenantWebService> </TenantWebServiceCollection> </ExportedData>
You may also merge multiple XML files into one:
<?xml version="1.0" encoding="utf-8"?> <ExportedData> <TenantWebServiceCollection> <TenantWebService> <ObjectType>Page</ObjectType> <ObjectID>21</ObjectID> <ServiceName>Customer</ServiceName> <Published>true</Published> </TenantWebService> <TenantWebService> <ObjectType>Page</ObjectType> <ObjectID>26</ObjectID> <ServiceName>Vendor</ServiceName> <Published>true</Published> </TenantWebService> </TenantWebServiceCollection> </ExportedData>
To add table data
Open the Business Central Development Shell.
Export the relevant data using the
Export-NAVAppTableData
cmdlet to export the data to a file. This includes setting the path to a folder where you want the .navxdata file created. A data file in the format ofTAB<TABLEID>.navxdata
will be created. (Example: TAB10000.navxdata).Export-NAVAppTableData -ServerInstance DynamicsNAV160 -Path 'C:\NAVAppTableData' -TableId 10000
Note
Export the data for each table to a separate XML file.
Add the exported table data files to the Visual Studio Code project that contains your extension.
Call the procedure in a Codeunit with the Subtype property
Install
orUpgrade
and specify the table ID in theNavApp.LoadPackageData
procedure as shown in the following example.codeunit 50100 MyExtensionUpgrade { Subtype = Upgrade; trigger OnUpgradePerDatabase() begin NavApp.LoadPackageData(50100); end; }
Warning
An extension can only include table data for new tables that are added as part of the extension.
To add custom report layouts
Open the Business Central Development Shell.
Export the relevant report layouts using the
Export-NAVAppReportLayout
cmdlet to export to a file:Export-NAVAppReportLayout -ServerInstance DynamicsNAV160 -Path .\ReportLayout.xml -LayoutId 1
Note
Export each custom report layout to a separate XML file.
Add the exported custom report files to the Visual Studio Code project that contains your extension.
See Also
Developing Extensions in AL
Converting Extensions V1 to Extensions V2
Writing Extension Install Code
Feedback
Submit and view feedback for