21 Dec’16

Dynamics NAVAL language code sample in Visual Studio for developing extensions for Dynamics NAV

Microsoft has released AL language code samples for developing extensions for Dynamics NAV.  This AL sample code is available to download from the following link: https://github.com/Microsoft/AL. Microsoft wants to move all development very soon to Visual Studio using AL code for Dynamics NAV and Dynamics 365 Financials. Hence, programming for developing extensions for Dynamics NAV and Dynamics 365 have to be done in Visual Studio in the future.

This article explains about the AL sample code for developing extensions for Dynamics NAV in Visual Studio.


Visual Studio


To understand AL language code sample for developing extensions for Dynamics NAV in Visual Studio.


  1. The new version of extensions will be called ‘Extensions 2.0’ which is not based on the Delta file design. With Extensions 2.0, developers need to code and write new objects that describe additional capabilities required in the system. ‘Table Extension’ and ‘Page Extension’ objects will be used to describe new fields and UI elements and ‘in-client page designer’ will be used to make those changes in a WYSIWIG way-all of which are stored as extensions under the cover.

    This is referred from the following link:


  2. In the AL sample code released by Microsoft, there are three .al files i.e. HelloWorld.al, GreetingsManagement.al and CustomerCardExtension.al and two .json files i.e. launch.json and app.json.
  3. CustomerCardExtension.al and HelloWorld.al are adding an action on Customer Card page. CustomerCardExtension.al is a ‘pageextension’ object type. The RunObject property of CustomerCardExtension.al calls HelloWorld.al which is a codeunit object.

    Fig. 1: CustomerCardExtension.al calls the Codeunit HelloWorld.al

    The keyword extends tells the compiler that this object is extending an existing object that is named after.

  4. On clicking this new action which is created on Customer Card page, Codeunit GreetingsManagement.al runs and generates a greeting message. GreetingsManagement.al is a codeunit for creating random greetings.

    Fig. 2: Codeunit GreetingsManagment.al

  5. While creating extensions in the previous way, manifest file has to be generated using Windows PowerShell ISE which is done after creating delta files. But while using AL code for developing extensions for Dynamics NAV in Visual Studio, ‘app.json’ file is required. ‘app.json’ is a manifest file that defines how your code should be built and bootstrapped into a live application. It enables developers to define their applications’ details, setup configurations and runtime environments in a structured way.

    Fig. 3: app.json

  6. To debug your app in VS Code, it is needed to set up launch configuration file which is ‘launch.json’.

  7. Fig. 4: launch.json


    The Visual Studio Code editor will become the preferred way of doing modifications in the future and all extensions for Dynamics NAV will be done in Visual Studio. Microsoft has mentioned that in the future, they will be adding support for XML Ports, Queries and Reports in Visual Studio Code.


    Written by

    Team Member


Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.

Want to streamline your business processes?

  • This field is for validation purposes and should be left unchanged.

Recent Articles

  • Managing mailbox through Email Archiving

    20 March’ 2018

    Introduction: Email can fill your Outlook Inbox quickly – new messages, replies, and forwards. Before you know it, yo...

    Read more
  • Workaround to Report.SAVEASPDF in NAV 2018

    20 March’ 2018

    Objective: In NAV 2017 Emailing the PDF by running the report using Report.SAVEASPDF is now not allowed in NAV 2018. Th...

    Read more
  • Dynamics 365 Client Diagnostics

    15 March’ 2018

    Main cause of Performance Issues: Bandwidth and latency are the primary characteristics which affects the performance o...

    Read more
  • Closing Blind Shift in MPOS and CPOS in Dynamics 365 for Retail

    15 March’ 2018

    Manual For closing Blind shift in POS: Blind shifts terminate the currently ongoing shift and when logged in a new shif...

    Read more
  • Persistent Filters in the Power BI Service

    13 March’ 2018

    Introduction: The feature is finally release, and it is power BI has announced general availability of persistent filt...

    Read more