Monthly Archives: March 2020

Interfaces in AL (part 1)

With Microsoft Dynamics 365 Business Central 2020 Wave 1 (respectively with Runtime 5.0) a new object type has been introduced – Interfaces. This term is well known from other programming languages and probably a lot of readers have already used them in some way.

The general definition of the interface object could be found anywhere on the Internet. For example, the definition on Wikipedia:

The term interface is used to define an abstract type that contains no data but defines behaviours as method signatures. A class having code and data for all the methods corresponding to that interface and declaring so is said to implement that interface.

An interface is thus a type definition; anywhere an object can be exchanged (for example, in a function or method call) the type of the object to be exchanged can be defined in terms of one of its implemented interfaces or base-classes rather than specifying the specific class. This approach means that any class that implements that interface can be used.

Usually a method defined in an interface contains no code and thus cannot itself be called; it must be implemented by non-abstract code to be run when it is invoked.

https://en.wikipedia.org/wiki/Interface_(computing)

Okay, but what does it mean in term of programming in AL language? The interface described in the quotation above is the new special object type “Interface” and the “non-abstract class” is, in our case, Codeunit object with a special construction that defines that the Codeunites implements an Interface.

 interface "TKA Our Interface Object"
 {
    procedure MyProcedureDefinedInTheInterfaceObject();
 }

 codeunit 50001 "TKA Our Codeunit Object" implements "TKA Our Interface Object"
 {
    procedure MyProcedureDefinedInTheInterfaceObject();
    begin
        // TODO Implementation of procedure MyProcedureDefinedInTheInterfaceObject
    end;
 }

In the next part of this article series, I will describe Interfaces on the more advanced example.

CU 2020/03 for Microsoft Dynamics NAV 2016 – 2018 and Microsoft Dynamics 365 Business Central on-premises has been released

The cumulative update 2020/03 for Microsoft Dynamics NAV 2016, NAV 2017, NAV2018 and for Microsoft Dynamics 365 Business Central (2018, 2019 wave 1, 2019 wave 2) on-premises has just been released.

VersionLinks
Microsoft Dynamics NAV 2016/CU53DownloadDocumentation
Microsoft Dynamics NAV 2017/CU40DownloadDocumentation
Microsoft Dynamics NAV 2018/CU27DownloadDocumentation
Microsoft Dynamics 365 Business Central on-premises/CU17DownloadDocumentation
Microsoft Dynamics 365 Business Central Spring 2019 on-premises/CU10DownloadDocumentation
Microsoft Dynamics 365 Business Central 2019 Wave 2 on-premises/U15.4DownloadDocumentation