Guidelines for Partners
AL extension development has gotten more and more complicated over the years. However, some features are still missing from the AL Language extension for Microsoft Dynamics 365 Business Central, which sometimes results in the code developer having to write a lot of repetitive code by hand, slowing down the whole development process. But do not fear because there is a solution – the AZ AL Dev Tools/AL Code Outline Visual Studio Code extension.
The AZ AL Dev Tools/AL Code Outline Visual Studio Code extension aims to streamline AL extension development by adding such features to an AL developers arsenal:
- AL objects wizards
- Symbols browser
- AL symbols outline panel
- Symbols tree view
- AL code generators
- Code actions
- Code transformation commands
- Action images browser
- Custom editors
- Documentation comments support
- Duplicate code search
- Warning directives panel
- Code analyzers rules viewer
- Document syntax visualizer
- Code completion
In this post, I will not go over all the features, though I will cover the most commonly used ones.
AL objects wizards is a feature that saves many developers’ precious time. It allows developers to create AL objects without going through the tedious processes of creating pages by hand. For example, with a new page wizard a developer can more easily and quickly create a new page and add the wanted fields.
Creation of an example page using AL Page Wizard
After launching the wizard and choosing to create a page, the user is greeted with this menu where one enters the object’s properties and clicks “Next”:
Afterward, the user is brought to this menu where they can use their mouse to select which fields from the source table they want to add to the page and add them by clicking the “>” button. Finally, the user clicks the “Finish” button:
And that is it; a new page is created with all of the desired fields and properties:
AL Code generators can create new card and list pages, reports, xmlports, and queries with all fields from selected table symbols. It can also create an empty page or table extension from page or table symbols. Generators can be invoked using the context menu on symbols in the “AL Outline” view and in the “Symbols Browser”.
Symbols Browser is a feature that allows users to comfortably view all of their project’s objects grouped by object type in a list, display their details, and run code generators on them, similar to the object explorer of previous NAV development environments.
AL Symbols Outline Panel is another super useful feature. It works similarly to the standard VS Code Outline view by displaying the code outline of the currently active editor and allowing the user to click on one of the symbols tree nodes to move the cursor to that symbol in the code editor. Though the AL Symbols Outline Panel is more suited for AL development than the standard VS Code Outline view because it supports syntax node types specific to AL, displays custom icons, and allows to invoke some commands on them using a context menu such as:
- Run pages, reports, and tables in web client.
- Run code generators to create a new card and list pages reports, xmlports and queries with all fields from selected table symbols.
Code actions added by the AZ AL Dev Tools/AL Code Outline Visual Studio Code extension to some of AL elements help developers modify or insert code quickly.
These include actions such as:
- Sorting actions
- Sort table fields
- Sort procedures
- Sort data item columns
- Sort properties
- Sort variables
- Sort permissions and permission sets
- Sort customizations
- Code generation actions
- Create interface
- Add all extension objects permissions
- Add all permissions to all tables used by this object
- Reuse the tooltip from other pages
- Add multiple fields
- Generate column headers for CSV export
Here is an example of “Add multiple fields” code generation action:
With the cursor on the group, choose the Quick Fix option “Add multiple fields (AZ AL Dev Tools)”:
From this dropdown menu, choose the wanted fields and click the “OK” button:
And it is done! The group is now filled with the chosen fields.
Code transformation commands also allow the developer to avoid tediously typing boilerplate code. AZ AL Dev Tools/AL Code Outline Visual Studio Code extension’s code transformation commands include:
- Add Application Areas to the active Editor/Project
- Remove redundant Application Areas from the active Editor/Project
- Add ToolTips to the active Editor/Project
- Refresh ToolTips from dependencies in the active Editor/Project
- Add table field captions to the active Editor/Project
- Add Page Controls Captions to the Active Editor/Project
- Remove ‘with’ usage from the Active Editor/Project
- Fix Keywords Case in the Active Editor/Project
- Remove Unused Variables from the Active Editor/Project
- Remove Begin..End around Single Statements from the Active Editor/Project
- Remove Empty Triggers from the Active Editor/Project
And many more commands.
Example of using the “Add ToolTips to the active Editor” command:
After running the command:
In summary, the AZ AL Dev Tools/AL Code Outline VS Code extension is an incredibly useful tool with many features, from code sorting to AL object creation wizards. If used correctly, it will surely decrease the time an AL developer spends writing repetitive code by hand and increase their effectiveness.