Share This Post

Business Central

Exporting Business Central Data for Extensions

This article explains about Exporting Business Central Data for Extensions. For your extension to execute 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

For Exporting Business Central Data, 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.

Exporting Business Central Data for Extensions Process

1. To Export Permission Sets

  • Open the MS Dynamics NAV Development Shell.
  • Export the relevant permission set utilizing the Export-NAVAppPermissionSet cmdlet to export the permission set to a file. The following command exports the BASIC permission set.

Export-NAVAppPermissionSet -ServerInstance DynamicsNAV110 -Path '.\PermissionSet.xml' -PermissionSetId BASIC

  • Add the exported permission set files to the Visual Studio Code project that contains your extension.

For Exporting Business Central Data, export each permission set to a separate XML file. 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.

2. To Export Web Services

  • Open the Microsoft Dynamics NAV 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 DynamicsNAV110 -Path TenantWebService.xml -ServiceName Customer -ObjectType Page -ObjectId 21

  • Add the exported web services files to the Visual Studio Code project that contains your extension. Export each web service to a separate XML file.

3. To Export Table Data

  • Open the Microsoft Dynamics NAV Development Shell.
  • For Exporting Business Central Data, 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 of TAB.navxdata will be created. (Example: TAB10000.navxdata).

Export-NAVAppTableData -ServerInstance DynamicsNAV110 -Path ‘C:\NAVAppTableData’ -TableId 10000

  • Add the exported table data files to the Visual Studio Code project that contains your extension. Export the data for each table to a individual XML file.
  • Call the procedure in a Codeunit with the Subtype property Install or Upgrade and specify the table ID in the NavApp.LoadPackageData procedure as shown in the following example.

codeunit 50100 MyExtensionUpgrade
{
Subtype = Upgrade;
trigger OnUpgradePerDatabase()
begin
NavApp.LoadPackageData(50100);
end;
}

4. To Export Custom Report Layouts

  • Open the Microsoft Dynamics NAV Development Shell.
  • Export the relevant report layouts using the Export-NAVAppReportLayout cmdlet to export to a file:

Export-NAVAppReportLayout -ServerInstance DynamicsNAV110 -Path .\ReportLayout.xml -LayoutId 1

  • Add the exported custom report files to the Visual Studio Code project that contains your extension. Export each custom report layout to a separate XML file.

Container Sandbox Development Environment

Dynamics 365 Business Central offers a container based image environment that enables access to both the AL development environment and the C/SIDE development environment.

You setup a container sandbox by running the SANDBOX ENVIRONMENT (CONTAINER) page from Dynamics 365 Business Central.

You have to choose whether you want an Azure hosted or locally hosted container sandbox. See the next section for details.

1. Choosing an Azure Hosted or Local Hosted Container Sandbox

When you setup the container sandbox, you can choose to host the sandbox on Microsoft Azure or on a local computer.

Both environments offer the same capabilities and use Docker to provide the infrastructure for the container-based application.

2. Set Up an Azure-hosted Container Sandbox

  • If you you do not already have one, sign up for an Azure subscription.
  • In Dynamics 365 Business Central, choose the icon, enter SANDBOX ENVIRONMENT (CONTAINER) and then select the relevant link.
  • Choose Host in Azure. If prompted, enter the user name and password of your Azure subscription.
  • Fill out the required fields on the form, and then select Purchase.

3. Set up a Local-hosted Container Sandbox

  • If not already done, install Docker.
  • In Microsoft Dynamics 365 Business Central, choose the icon, enter SANDBOX ENVIRONMENT (CONTAINER), and then select the relevant link.
  • Choose Host Locally.
  • Save the CreateBCSandbox.ps1 file to your computer.
  • Run Windows PowerShell ISE as an administrator.
  • Open the CreateBCSandbox.ps1 file.
  • Set the $containername = '' variable to the name that you want to give the container, for example $containername = 'MyBizCentralApp'.
  • Set the $accept_eula = '' variable to '$true'.
  • Press F5 to run the script.
  • Write down or copy the following parameter/values from the console: Dev. ServerDev. ServerInstance, and Files.

After the container sandbox is set up, you must set up Visual Studio Code for extension development. To do this, you need the values for Dev. ServerDev. ServerInstance and Files parameters that you retrieved from the Windows PowerShell ISE console when you ran the CreateBCSandbox.ps1 script.

For more details on the process of Exporting Business Central Data for Extensions, please contact us.

Share This Post

Leave a Reply

avatar
  Subscribe  
Notify of
Skip to toolbar