Posts

Showing posts from November, 2023

How to create documentation comment using Custom Snippets in VS Code for AL - D365 Business Central.

Image
Code documentation is a process of writing additional information to help others understand how your code works. It can include anything from comments in the code to separate documents that explain the code’s architecture, dependencies, and purpose. Also, development teams have their own format for the documentation. Writing the document comment every time can be time consuming. For this we can create custom Snippets. To create a custom code documentation comment using snippets in Visual Studio Code, you can follow these steps: In VS Code Go to Settings -> User Snippets Select AL as we want this Snippet for AL language. al.json file will open then add configurations as follows: Add a new object with a name for your snippet and a prefix that will trigger the snippet. For this example, we write tDocumentationComment Add a description field to describe what the snippet does. Add a body field with the code you want to include in the snippet. You can use placeholders like ${1:variable} ...

Different use of AL Find Functions for Filters in Dynamics 365 Business Central

Image
This post provides tips about different find function in Business Central, including both long-standing C/AL strategies and newer concepts like partial records. FindSet vs FindFirst/FindLast FindSet and FindFirst/FindLast are two methods utilized in Dynamics 365 Business Central for extracting records from a table. The key distinction between them is that FindSet fetches a group of records, whereas FindFirst only fetches the initial record in the filter and FindLast fetches the last record. FindSet is employed when there’s a need to traverse through a sequence of records, and it’s advisable to use FindSet(true) if there’s a requirement to alter any record within the group. Conversely, FindFirst/FindLast is employed when only the initial or last record is needed and there’s no requirement for a loop. SetLoadFields  The SetLoadFields function only loads the specified fields, thereby not fetching the remaining fields in the table and ensuring a quicker load. It is suitable for searchi...