Book Image

Programming Microsoft Dynamics 365 Business Central - Sixth Edition

By : Marije Brummel, David Studebaker, Christopher D. Studebaker
Book Image

Programming Microsoft Dynamics 365 Business Central - Sixth Edition

By: Marije Brummel, David Studebaker, Christopher D. Studebaker

Overview of this book

Microsoft Dynamics 365 Business Central is a full ERP business solution suite with a robust set of development tools to support customization and enhancement. These tools can be used to tailor Business Central's in-built applications to support complete management functions for finance, supply chain, manufacturing, and operations. Using a case study approach, this book will introduce you to Dynamics 365 Business Central and Visual Studio Code development tools to help you become a productive Business Central developer. You'll also learn how to evaluate a product's development capabilities and manage Business Central-based development and implementation. You'll explore application structure, the construction of and uses for each object type, and how it all fits together to build apps that meet special business requirements. By the end of this book, you'll understand how to design and develop high-quality software using the Visual Studio Code development environment, the AL language paired with the improved editor, patterns, and features.
Table of Contents (12 chapters)
9
Successful Conclusions

Creating a simple table

The easiest way to create a table the easiest way is by using snippets. To use snippets, Visual Studio Code needs to understand that our file is written in the AL language. This is simply done by saving the file with the .al extension. We will save our newly created file using File | Save and using a name that makes sense later. Let's use Radio Show.al for now:

Now, we can use the snippet called ttable. If we type in the letters tta, IntelliSense will suggest this snippet:

This snippet creates content for our file and sets the cursor on the place where we need to define the object ID:

We will type 50100 and use Tab to go to the next field, object name, where we will type "Radio Show".

The snippet has already created a field with the default ID of 1. The field name is MyField and the type is Integer. We will change the name to "No." and the type to Code [20].

The next field can be field number 2. Sometimes, it is useful to leave large gaps (such as jumping from 80 to 200 or 500) when the next set of fields has a particular purpose that isn't associated with the prior set of fields.

The fields combining the primary key can use numbers up to nine since they are very unlikely to change. If this is changed at a later date, then a substantial amount of refactoring has to be done.

The Business Central online documentation says to not leave gaps in field numbers. Based on many years of experience, we disagree. Leaving numbering gaps will allow us to add additional fields between existing fields at a later date, if necessary. The result will be data structures that are (at least initially) easier to read and understand. Once a table is referenced by other objects or contains any data, the field numbers of the previously defined fields should not be changed.

The following screenshot shows our new table definition in the table designer:

Note that you can remove anything you don't need from the snippet. In our case, we removed the DataClassification and keys sections, the variable declaration, and triggers.