To begin writing extensions for Microsoft Dynamics 365 Business Central you will need a MS D365 Business Central tenant, Visual Studio Code and the Dynamics 365 Business Central AL Language extension. Visual Studio Code is a cross platform editor that you will use for coding and debugging.
Visual Studio Code offers the multi root work space feature which enables grouping different project folders into one work space. The AL Language extension also supports the multi-root functionality and allows you to work with multiple AL folders including roots and projects within one work space.
Dynamics 365 Business Central AL Language Process
1. Steps to Set Up a Sandbox Environment and Visual Studio Code
Go through the following steps to set up a sandbox environment. With this you get sample code that compiles and runs with just a few commands.
- Sign up for a Dynamics 365 Business Central sandbox.
- Download Visual Studio Code.
- Download the AL Language extension.
- Press Ctrl+, to open the user settings window, here you can alter the telemetry settings.
- Press Alt+A, Alt+L to trigger the AL Go! command, and then choose Microsoft cloud sandbox.
- Enter the credentials you provided for the signup, and then symbols will automatically start downloading. To manually download the symbols, press Ctrl+Shift+P and select AL: Download symbols.
- Press F5 to deploy and run the extension on your online sandbox tenant.
You now have a HelloWorld sample that compiles and runs. The JSON files in the project are automatically updated with the settings that allows you to press F5 to build and deploy the solution.
2. Tips and Tricks
- Use Ctrl+Space to activate IntelliSense.
- Always use the
.alextension on new files.
- Use the built-in snippets for code by starting typing
tand pick from the list.
- Create objects within the right object ranges.
- Build and get inspired by our sample library on GitHub.
- Use Ctrl+Shift+P to clear the credentials cache if you want to deploy against a different environment.
3. JSON File Settings
There are two JSON files in the project; the
app.json file and the
launch.json file. The files are automatically generated for your project.
4. Telemetry Settings
By default, Visual Studio Code is set up with a telemetry system to enable that data and errors are sent to Microsoft. If you do not want to send telemetry data, you can change the
To modify the telemetry setting, press Ctrl+, in Visual Studio Code and select the user settings window, which opens the
settings.json file and then add
telemetry.enableTelemetry and set it to
5. The Symbol File
The symbol file contains metadata of the application. This is what your extension is being built on and hence the symbol file must be present. If it is not present, you will be prompted to download it.
6. Installing and Publishing an Extension
To make your extension accessible to users, the package must be published to a specific Microsoft Dynamics 365 Business Central Server instance. The extension can be installed for one or more tenants.
7. Controlling User Access to Publishing Extensions
The access to publishing extensions is controlled on a user or user group basis by the D365 EXTENSION MGT permission set. To prohibit a user from publishing, just remove the user from the D365 EXTENSION MGT permission set.
Now that you have the tools and the HelloWorld example up and running, you might want to try to create a small sample app in AL. This walkthrough guides you through how to create a simple app adding objects, code and publishing the app to your tenant. For more information on Microsoft Dynamics 365 Business Central AL Language, please contact us.