It is clear that the future of NAV is Visual Studio Code and AL. And to be honest I find more fun and interesting to play with this “smart text editor” compared to the old “development UI” C/Side. Even if at the beginning it seems more difficult because you need to know in what places to add certain pieces of code related to the object’s structure while in C/Side you are helped by the UI.
So, I assume that you already installed a version of NAV 2018 and Visual Studio Code, but in case you didn’t you can download and install them from here:
NAV 2018 CU1
Visual Studio Code
Let’s see which are the steps you need to do in order to start writing AL extensions in Visual Studio Code and publish them to a local NAV 2018 server instance:
1) Enable Developer Service EndPoint on NAV Server Instance
2) Setup the Web Client Base URL:
3) Change NetFx40_LegacySecurityPolicy setting in Microsoft.Dynamics.Nav.Server.exe.config file to false and restart NAV Server. Please see the following link:
https://docs.microsoft.com/en-us/dynamics-nav/developer/devenv-debugging
In case you don’t change this setting you will get an error when you try to publish the extension and open the web client in debugging mode.
4) Open VS Code and install the Version of AL Language Extension from your NAV DVD:
You can find the “ALLanguage.vsix” in the following location:
5) Use command AL:Go! (CTRL + SHIFT + P and the search for command) in order to choose a location and create a folder with the default files of an extension:
6) Setup the “launch.json” file from the newly created folder:
By default the Development port is setup as 7049 at the NAV Server level. If you change this value, you will have to add also the new port number in the “launch.json” file as new key-value pair.
7) Download Symbols: CTRL + SHIFT + P and command AL: Download Symbols. If the symbols are successfully downloaded you will see this:
By doing this a new folder will be created in your project’s main folder: “.alpackages”. The symbols are references to the base application objects and system objects. This is how VS Code will know, for example, if you extend table 37 “Sales Line” by adding a new field what “table 37” means.
Because in this example we are using Windows authentication it does not ask for credentials. If you are using UserPassword option you will also need to enter credentials.
8) Publish the demo Extension and open Nav 2018 in debugging mode (in order to test connection): Press F5 or CTRL + SHIFT + P and command Publish:
9) If in your “launch.json” file the startupObjectId is 22 (Customer List), this page should open in NAV Web Client and because we extended it’s “OnOpenPage” trigger with a message you receive message:
10) Open page “Extension Management”. Here you can see that the extension was Published and Installed to the NAV Server when you used Command “Publish” in Visual Studio Code. Published means that the extension was “added” to the server and Installed means it was also “activated”.
You are now ready to develop in the new Nav 2018 Modern Development Environment using your local Nav Server Instance.