How to add XML comments in AL Code :- Business Central

With the release of Business Central Wave 1 2020 XML comments is available in AL code.

If you would like to add documentation to your code then you can use XML documentation .The documentation comment must immediately before the object such as codeunit,table,functions etc.

The syntax for adding XML comments in your code is triple slashes /// followed by one of the supported XML tags. There is IntelliSense support for writing documentation comments. Most importantly providing a template documentation comment when writing the third slash in the triple slash.

These documentation comments are visible when hovering over source symbols.

Advantage :

  1. XML document comment will improve readability ,add useful information about the code implementation and help others take over your code .
  2. With XML comments it also enable intellisense in AL objects that you add in your code as a help to other developers who is going extend your code.

Let sees an example how we can add the xml comments.

Created one simple code unit where we can add documentation comments.

Please note that If you have the showMyCode setting in the app.json file set to false and download an app package; the app package will not contain any XML comments.

Hope this will help you.

How to Create Custom Event in Business Central

Looking at the subject there are lot of blogs available but I am writing this based on one of the request from my colleague.

Everybody aware of that whenever you developed an app it need to be extensible and if anybody would like to add or modify any field or additional routing we need to have events which can extend the base functionality.

Step 1 :- Simple Quick action to add event in Business Central

Next step will be we can subscribe the event and add you own code.

It is so simple to add custom event in AL and allow other to extend your functionality.

Hope this will help you.

Stay tuned for more updates.

How to convert long code into Procedure in AL/Business Central.

With the different code actions it is very easy to convert your long code into procedures. Just a small tip to convert to your long code into smaller procedures.

To enable to code actions

Hope this will help you.

Stay tuned for more.

How to find Table Relation in Business Central.

With the release of business central new property is introduced to find the table relation of given field. This property is called as’ Relation’ which returns integer value

Lets see how we can find that .

To make it created one page extension and added one action button to display the value of table of given field.

If you see the highlighted area where in I have used relation property to find table id of CITY field of customer table.

Output of this simple code as follows

Hope this will help you

Stay tuned for more..

How to Implement Interface in Business Central

With the release of Business Central Wave 1 2020 new feature was introduced called ‘Interface’. It is basically syntactical contract that can be implemented by a non-abstract method. This allows for writing code that reduces the dependency on implementation details, makes it easier to reuse code.

Today we will see how to write an interface and implement in Business central.

For defining interface we no need to have object id.

If you can see in above interface we just define method but not programmed any business logic.

Now Lets see how to implement interface.

Added new code unit which implements the defined interface.

For checking the result of interface created following page with one function.

Above function to initialize the interface.

Lets check the result of interface.

Hope this will help you to understand interface and implementation.

To understand more on differentiate between events and interface read Interface Vs Events..

Stay tuned for more…

Cumulative Update for Business Central Wave 1 2020

Cumulative Update includes all application and platform hotfixes and regulatory features that have been released for Microsoft Dynamics Business Central

Business Central Wave 1 2020 (16.2) :- 16.2

Warning

Before you install a cumulative update in a production environment, take the following precautions:

  1. Test the cumulative update in a non-production environment.
  2. Make a backup of the system or computer where the cumulative update is to be installed.

Stay tuned for more updates…

How to extend TableRelation Property-Business Central

Last week somebody asked me on can we extend table relation property and my answer was yes we can achieve this by table extension.

Today we will see how we can do that

Firstly create enum extension and extend as follows . For this demo I used Type field from Sales line table.

enumextension 50145 PlaySaleDocType extends "Sales Line Type"
{
    value(8; Retail)
    {
        Caption = 'Retail';
    }
}

Secondly create a table extension and modify required table relation property.

tableextension 50146 PlaySalesTabRelExt extends "Sales Line"
{
    fields
    {
        modify("No.")
        {
            TableRelation = if (type = const(Retail)) Retail;
        }
    }

}

Hope this will help you.

Stay tuned for more update.

Business Central:- How to find Events in AL

With the release of Business Central 2020 Wave 1 and AL extension lot of new features has been added to make AL development more productive.

A core part of extension-based development is the use of events and event subscribers. Use the new Shift+Alt+E shortcut in the AL code editor to invoke a list of all events.

Hope this will help you

Stay tuned for more.

Business Central 2020 Wave 1: New CodeCops

With the release of Business Central 2020 Wave 1 and AL extension new codecops added for more information and making your app more prominent

AA0215 – Checking file naming

This checks file name as per new guidelines and shows warning as below

Following are the new guidelines for this warning

Object NameFile Name
Codeunit 50000 “Post Bank Details”PostBankDetails.Codeunit.al
Page 50000 “Customer Card Ext”CustomerCard.PageExt.al

To Get this done automatically use Waldo’ CRS extension

AA0218,AA0219,AA0218 – Missing and Wrong ToolTips

This will show warning for missing Tooltips as below

AA0470- Comments in Labels

Placeholders should have a comment explaining their content.Provide an explanation that describes the content of each of the placeholders.

To fix this Adding the comment

There are more code analyzer added and you can find this from following link

https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/analyzers/codecop

Stay tuned for more ….

Cumulative Update for Business Central Wave 2

Cumulative Update includes all application and platform hotfixes and regulatory features that have been released for Microsoft Dynamics Business Central Wave 2 2019 Release

Download update from below

Update 15.3 for Microsoft Dynamics 365 Business Central 2019 Release Wave 2

Warning

Before you install a cumulative update in a production environment, take the following precautions:

  1. Test the cumulative update in a non-production environment.
  2. Make a backup of the system or computer where the cumulative update is to be installed.

Stay tuned for more updates…