Tuesday, November 27, 2018

What are Code Snippets in Dynamics 365 Business Central?

Hi Readers ,

This blog is for all the NAV developers who want to switch from CAL Code to AL Extension and

specially Visual Studio Code. Visual Studio has provided us some special feature called code snippet

while extending the functionality of existing NAV. So have a look on this blog how many snippets

are available as of now. And What are these Code Snippets.

To create an application, we have to write a lot of code. For example, if we want to create a table, we 

can type table, then the ID and the name of our table. But we can also make use of code snippets. So

 if we type ttable, we get a snippet for table. 

If you just press the tab button, we get the complete structure for a table, so we just have to replace 

the ID, for example, with 50100, give it a name, for example, car, and then we can see that there's 

already a structure to define fields, keys and triggers. 

We can do the same with, for example, a page, so we type tpage, tab, and we get immediately a 

structure for creating a page. Here we can see an overview of commonly used snippets. We already 

saw the ttable and tpage, but we also have code snippets for codeunits to create triggers, or if you 

would like to have an if-else structure or case structure. You see, there is a lot of snippets in Visual Studio Code.

Screens where I had used these Snippets.

Lets get started with New World of Extensions.

No comments:

Post a Comment