Dynamics 365 Business Central: Using AL Code Actions

Dynamics 365 Business Central

Hi, Readers.
Today I would like to talk about AL Code Actions.
The AL Language extension offers users the option to help fix issues in code. Code Actions is a Visual Studio Code feature providing the user with possible corrective actions right next to an error or warning. If actions are available, a light bulb appears next to the error or warning. When the user clicks the light bulb (or presses Ctrl+.), a list of available code actions is presented.

So, Code Actions provides possible corrective actions which will help the developer to code in a better way.

In AL Language extension these code actions are available in the current version (v7.1.453917 2021/05/12):

  • Multiple IF to CASE converting code action.
  • Spell check code action.
  • Interface implementer.
  • Make method local.
  • Use parenthesis for method call.
  • Fix explicit with statements.
  • Fix implicit with statements.

To enable AL Code Actions, open the Settings Page, navigate to Extensions > AL Language extension configuration, then click on the Enable Code Actions checkbox.


Open the settings.json file, then enter the setting al.enableCodeActions and set it to true like this “al.enableCodeActions”: true.

Let’s look at a few examples.

1. Convert the ‘with’ statement to fully qualified statements.

2. Qualify with ‘Rec’ -> All occurrences in this object.

3. Fix typo.

4. Convert to ‘case of’.

Update: New AL Code Action for multiple layouts (Convert RDLCLayout/WordLayout/ExcelLayout to Rendering report session)


Hope this will help.

Thanks for reading.



Copied title and URL