Wednesday, April 29, 2020

Business Central – AL Configuration Files


Business Central – AL Configuration Files

Business Central AL extension contains two JSON (JavaScript Object Notation) files: ”app.json” and “launch.json” file. These files will be automatically created when you create a new AL extension.  These files are used to store configuration data to the Sand Box / Docker Environment or your Local Environment.

launch.json

Launch.json is a configuration file that contains information about the server where the extension will be deployed to test and debug. Two configurations can be used, depending on whether the extension is published to a local server or to the cloud.

Example from Local Server:
{
    "version""0.2.0",
    "configurations": [
        {
            "type""al",
            "request""launch",
            "name""Your own server",
            "server""http://localhost",
            "serverInstance""BC160",
            "authentication""Windows",
            "port"7779,
            "startupObjectId"22,
            "startupObjectType""Page",
            "breakOnError"true,
            "launchBrowser"true,
            "enableLongRunningSqlStatements"true,
            "enableSqlInformationDebugger"true
        }
    ]
}

Note: Must define “port”, if it is not default one 7049.

Setting
Mandatory
Value
name
Yes
Microsoft cloud sandbox
type
Yes
Must be set to .al. Required by Visual Studio Code.
request
Yes
Must be set to launch. Required by Visual Studio Code.
startupObjectId
No
Specifies the ID of the object to open after publishing.
startupObjectType
No
Specifies the type of object to open after publishing. This setting is used in combination with the startupObjectId setting. Only objects of type Page, Table, Query, and Report are currently supported.
tenant
No
Specifies the tenant to which the package is deployed. If you specify multiple configurations, a drop-down list of options will be available when you deploy. This parameter must contain a tenant Microsoft Azure Active Directory (Azure AD) domain name, for example mycustomer.onmicrosoft.com.
sandboxName
No
Specifies which sandbox to use in cases where multiple sandboxes are owned by the same tenant.
breakOnError
No
Specifies whether to break on errors when debugging or not. The default value is true.
breakOnRecordWrite
No
Specifies if the debugger breaks on record changes. The default value is false.
launchBrowser
No
Specifies whether to open a new tab page in the browser when you are publishing the AL extension (Ctrl+F5). The default value is false. If the value is not specified or set to true, the session is started. If the value is explicitly set to false, the session is not started unless you launch your extension in debugging mode.
enableSqlInformationDebugger
No
Specifies whether the debugger shows the SQL information.
enableLongRunningSqlStatements
No
Specifies whether the debugger enables long-running SQL statements in the debugger window.
longRunningSqlStatementsThreshold
No
Sets the number of milliseconds that are spent before a SQL statement is considered as long-running in the debugger.
numberOfSqlStatements
No
Sets the number of SQL statements to be shown in the debugger.

App.json

The app.json file contains information about the extension that you are building, such as publisher information, name, and the minimum supported version. Often the app.json file is referred to as the manifest.

Example from Local Server:
{
  "id""4b0d0d4f-f04b-4c12-b36f-07836ff5229b",
  "name""ALProject4",
  "publisher""Default publisher",
  "version""1.0.0.0",
  "brief""",
  "description""",
  "privacyStatement""",
  "EULA""",
  "help""",
  "url""",
  "logo""",
  "dependencies": [
    {
      "id""63ca2fa4-4f03-4f2b-a480-172fef340d3f",
      "publisher""Microsoft",
      "name""System Application",
      "version""16.0.0.0"
    },
    {
      "id""437dbf0e-84ff-417a-965d-ed2bb9650972",
      "publisher""Microsoft",
      "name""Base Application",
      "version""16.0.0.0"
    }
  ],
  "screenshots": [],
  "platform""16.0.0.0",
  "idRanges": [
    {
      "from"50100,
      "to"50149
    }
  ],
  "contextSensitiveHelpUrl""https://ALProject4.com/help/",
  "showMyCode"true,
  "runtime""5.0"
}

Setting
Mandatory
Value
id
Yes
The unique ID of the extension. When the app.json file is automatically created, the ID is set to a new GUID value.
name
Yes
The unique extension name.
publisher
Yes
The publisher name.
brief
No*
Short description of the extension.  *Required for AppSource submission
description
No*
Longer description of the extension. *Required for AppSource submission
version
Yes
The version of the app package.
dependencies
No
List of dependencies for the extension package. For dependencies to the System Application and Base Application, you must have a reference such as: "dependencies":         
[{"id": "63ca2fa4-4f03-4f2b-a480-172fef340d3f",
"publisher": "Microsoft",
"name": "System Application",
"version": "16.0.0.0"},  {
"id": "437dbf0e-84ff-417a-965d-ed2bb9650972",
"publisher": "Microsoft",
"name": "Base Application",
"version": "16.0.0.0"}]
platform
Yes
The minimum supported version of the platform symbol package file. This setting is needed if system tables are references in the extension.
idRanges
Yes
A range for application object IDs. Objects outside the range will raise a compilation error. A new ID is automatically suggested.
runtime
Yes
The version of the runtime that the project is targeting. The project can be published to the server with an earlier or the same runtime version. The available options are: 1.0 - Business Central April 2018 release, 2.2 - Business Central October 2018 release CU 2, 3.0 - Business Central April 2019 release, 4.0 - Business Central 2019 release wave 2, 5.0 - Business Central 2020 release wave 1.

Content Source: Microsoft Docs