MADHDA Business Solutions
  • Home
  • About Us
    • Privacy Policy
  • Services
    • Implementations
    • Support
    • Training
    • Upgrade
    • Business Analysis
  • Solutions
    • MS Dynamics 365 Business Central
    • MS Dynamics Nav
    • MS Dynamics 365 Sales/CRM
    • Power BI
    • Power Automation
  • Resources
    • Blog
  • Contact Us
  • How to Create AL Snippets Using Visual Studio Code For Microsoft Dynamics 365 Business Central

How to Create AL Snippets Using Visual Studio Code For Microsoft Dynamics 365 Business Central

24 July 2020

How to Create AL Snippets Using Visual Studio Code For Microsoft Dynamics 365 Business Central

What Are AL Snippets ?

AL Snippets are pieces of AL code or small templates that can be recycled and reused for faster coding in Visual Studio code.

If you are working on AL then it show AL snippets and if you are working on other extension then it shows you that extension’s snippets.

Create Snippet in AL

We will Open Vs Code

Go to View then select Command Palette or  you can press COMMAND + SHIFT + P to open the command palette.

 

Find  “Preferences: Configure User Snippets”.

 

 

 Click “New Global snippets file”.

 

 

Give your snippets file name.

 

Snippet can be defined in Scope Prefix body and Description.

This will open up file with Filename.al.code-snippets extension in ~/Library/Application Support/Code/User/snippets/filename.code-snippets.

 

Here I have created a snippet for repeat until Loop in AL which we use frequently. We can use the snippet by typing Repeat and it will show us the Global Snippet in suggestion.

 

 

Use Snippet in AL

In the new line, writing repeat ,This will activate Intelligence and show you the series of snippets, including the one you just created. Choose repeat from the list, and it will add the until  line.

 

Here  see after we writing repeat it automatically entered until statement.

 

 

The AL snippet we have created will write the code for the Repeat until.

Snippet will reduce down our efforts of remembering the syntax.

Similarly, you can define as many user-defined snippets as you like for other functions.

 

Previous post: Enum objects in Business Central that how to use and extend
Next post: Converting Dynamics NAV Objects from C/AL to AL

Categories

  • Microsoft Dynamics 365
  • Microsoft Dynamics Business central
  • Microsoft Dynamics NAV
  • Uncategorized

Recent Post

  • Business Central : Retrieving Azure AD User information via AL.
    March 20, 2023
  • Change Authentication method from Basic Auth to OAuth2 while accessing Business Central Webservice / APIs.
    February 27, 2023
  • How to use "Dictionary" Object type into Business Central.
    February 17, 2023
  • Post Transaction Using Configuration Package in Business Central.
    February 13, 2023
  • How to Import Image from Excel to BC using Azure function.
    February 6, 2023
 


    © Copyright 2020 | All Rights Reserved By MADHDA