Reader small image

You're reading from  Mastering Microsoft Dynamics 365 Business Central

Product typeBook
Published inDec 2019
PublisherPackt
ISBN-139781789951257
Edition1st Edition
Right arrow
Authors (2):
Stefano Demiliani
Stefano Demiliani
author image
Stefano Demiliani

Stefano Demiliani is a Microsoft MVP on Business Applications and Azure, MCT, Microsoft Certified Solution Developer (MCSD), Azure Certified Architect, and an expert in other Microsoft related technologies. His main activity is architecting and developing enterprise solutions based on the entire stack of Microsoft technologies (mainly focused on ERP and serverless applications). He has worked with Packt Publishing on many IT books related to Azure cloud applications and Dynamics 365 Business Central and is a frequent speaker at IT conferences around Europe. In his free time Stefano is also a runner and a cyclist.
Read more about Stefano Demiliani

Duilio Tacconi
Duilio Tacconi
author image
Duilio Tacconi

Duilio Tacconi is a Microsoft Dynamics NAV/Microsoft Dynamics 365 Business Central Escalation Engineer at Microsoft EMEA Customer Support & Services (CSS). He joined Microsoft in 2008 after working in a customer IT department with a focus on system administration and development. Despite graduating with the highest score in Agricultural Science in 1996, he is in the ERP circuit since 1998 as developer and system implementer for several companies with Microsoft and non-Microsoft technologies. Currently, he is a subject matter expert in EMEA for RDLC Report development and one of Microsoft EMEA CSS reference for Managed Service for Partners (MSfP). Three times IronMan finisher, Duilio lives in Cernusco Sul Naviglio (Italy) with his beloved wife Laura and his 2 years old son Leonardo.
Read more about Duilio Tacconi

View More author details
Right arrow

Mastering a Modern Development Environment

In the previous chapter, we introduced Dynamics 365 Business Central and revealed that its skeleton is Microsoft cloud microservices.

In this chapter, we will take a close look at the development environment. We will discuss the main shortcuts, tips, and tricks related to Visual Studio Code, the official development platform, and the AL language, the development language extension. The union between Visual Studio Code and AL defines the so-called modern development environment.

AL is the official extension provided by Microsoft, free of charge, through the online marketplace. Officially released in 2017 to extend what was then called Dynamics 365 for Financials, it is now a solid fully fledged development language that extends Dynamics 365 Business Central. It comes equipped with a lot of features that greatly enhance developers&apos...

Mastering Visual Studio Code

Visual Studio Code is one of the most widely used development environments worldwide. It is engineered to make it easy and quick to design cloud- and web-based applications, using a plethora of extensible languages. The application is focused on maximizing code editing and also unleashing the developer's potential by providing useful shortcuts to provide quick access to all that is needed in a specific development context.

When you start Visual Studio Code, freshly installed, it will show you the typical Welcome page:

The Welcome page contains the following:

  • Start: Shortcuts for creating and opening files and folders
  • Recent: A list of recently opened files and folders
  • Help: A list of documentation sheets, product docs, videos, and useful resources
  • Customize: How to customize Visual Studio Code through extensions, keyboard shortcuts, background...

Visual Studio Code – the editing features

Visual Studio Code provides many of the features that you would expect from the best-in-class code editor. If you are familiar with Visual Studio, you might have noticed that some features have been inherited from this IDE, or engineered in a similar way.

Developed by developers for developers, Visual Studio Code has keyboard shortcuts for almost every editing command, giving you the option to edit code faster, and completely forget about the mouse.

Let's study these features in the following sections.

Comment lines

Visual Studio Code provides out-of-the-box commands for text selection and professional editing in the Edit menu. The Edit menu also includes Toggle Line Comment...

Understanding the AL Language extension

AL is now a cross-platform language that is deployed through an extension for Visual Studio Code. This extension not only supports deployment on Windows OSes, but is also supported for the macOS version of Visual Studio Code.

The free AL Language extension (https://marketplace.visualstudio.com/items?itemName=ms-dynamics-smb.al) is available for download from the Visual Studio Code marketplace. This provides an optimized experience for Dynamics 365 Business Central extension development, and includes all the support and tools that you need to build apps (from now on, a synonym for extension), including the debugger.

The easiest way to get the extension installed without further information is by opening any Dynamics 365 Business Central code file (.al) and following the instructions shown by Visual Studio Code when it detects that an extension...

Understanding symbols

Like in all other languages, symbols represent references to a collection of standard objects, properties, and functions. They are a special extension file themselves with the typical .app naming convention and are used to maintain object reference consistency while compiling, and they also populate valid IntelliSense entries.

Symbols are typically stored inside the database in a BLOB field in JSON for each object record. It is worth mentioning that in multitenancy, the Object Metadata table is part of the application database, so in customer tenant databases there are no system symbols or metadata stored, only data.

With Dynamics 365 Business Central, symbols are already preloaded inside the application database, and these can be grouped into two classes:

  • Standard symbols
  • Extension symbols

Prior to the Fall 2019 update, standard application symbols were...

Understanding AL Language extension configuration

General and per workspace settings can be easily shown through the shortcut key, Ctrl+. An intuitive menu will be shown, and by selecting Extension | AL language extension configuration, a set of configuration parameters is listed. The following screenshot shows the AL Language extension configuration parameters:

Basically, these configuration values are saved into a file called settings.json.

The following is a list of the description and values of the most common ones:

  • For the following Path parameters:
    • "al.packageCachePath": "./.alpackages": It is possible to change the default value to a local folder or to a shared folder for multi-developer environments. It represents the path to store and look for symbols.
    • "al.assemblyProbingPaths": ["./.netpackages"]: This parameter is fundamental...

Mastering AL Language code snippets

AL Language standard code snippets in Visual Studio Code are available after installing the AL Language extension. These are triggered as you type within the code editor, and you can recognize them by a squared prefix symbol.

Typically, they start with the letter t and are followed by a meaningful name that describes what the snippet is about, for example, ttable or tpage. A tooltip shows a preview of the code snippet.

The following screenshot shows the standard snippet for an if-then-else conditional sentence:

Notice that if the snippet contains variable names or code identifiers, they could be highlighted, suggesting that you should give them a different name and that they act as a sort of placeholder. When you rename a highlighted identifier, all occurrences will be also renamed, making snippet usage very flexible. This will not only reduce...

Summary

Visual Studio Code is a code-centric tool that supports, out of the box, a wide variety of languages, providing coding features such as syntax colorization, delimiter matching, code block folding, multiple cursors, code snippets, IntelliSense, and so much more.

By installing the AL Language extension, this modern development environment is fully set up as an app playground for beginner and skilled developers. We have unleashed some tips and tricks in this chapter that enable you to be proficient in the developer's daily work of creating modern apps for Dynamics 365 Business Central.

We then moved on to learn about the powerful coding features that this modern development environment offers. After all of this, it is time to see the AL Language in action throughout this book. But before moving to structured and advanced extension development, it is important to understand...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Mastering Microsoft Dynamics 365 Business Central
Published in: Dec 2019Publisher: PacktISBN-13: 9781789951257
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (2)

author image
Stefano Demiliani

Stefano Demiliani is a Microsoft MVP on Business Applications and Azure, MCT, Microsoft Certified Solution Developer (MCSD), Azure Certified Architect, and an expert in other Microsoft related technologies. His main activity is architecting and developing enterprise solutions based on the entire stack of Microsoft technologies (mainly focused on ERP and serverless applications). He has worked with Packt Publishing on many IT books related to Azure cloud applications and Dynamics 365 Business Central and is a frequent speaker at IT conferences around Europe. In his free time Stefano is also a runner and a cyclist.
Read more about Stefano Demiliani

author image
Duilio Tacconi

Duilio Tacconi is a Microsoft Dynamics NAV/Microsoft Dynamics 365 Business Central Escalation Engineer at Microsoft EMEA Customer Support & Services (CSS). He joined Microsoft in 2008 after working in a customer IT department with a focus on system administration and development. Despite graduating with the highest score in Agricultural Science in 1996, he is in the ERP circuit since 1998 as developer and system implementer for several companies with Microsoft and non-Microsoft technologies. Currently, he is a subject matter expert in EMEA for RDLC Report development and one of Microsoft EMEA CSS reference for Managed Service for Partners (MSfP). Three times IronMan finisher, Duilio lives in Cernusco Sul Naviglio (Italy) with his beloved wife Laura and his 2 years old son Leonardo.
Read more about Duilio Tacconi