This content is archived and is not being updated. For the latest documentation, see Microsoft Dynamics 365 product documentation. For the latest release plans, see Dynamics 365 and Microsoft Power Platform release plans.
|Enabled for||Public preview||General availability|
|Admins, makers, or analysts, automatically||Feb 1, 2020||Apr 2, 2020|
An interface is used when you want to decide which capabilities need to be available for an object, while allowing actual implementations to differ, as long as they comply with the defined interface.
This allows for writing code that reduces the dependency on implementation details, makes it easier to reuse code, and supports a polymorphing way of calling object methods, which again can be used for substituting business logic.
Use the new interface object to declare an interface name along with its methods, and apply the implements keyword along with the interface names on objects that implement the interface methods.
The interface object itself does not contain any code, only signatures, and cannot itself be called from code, but must be implemented by other objects.
The compiler checks to ensure implementations adhere to assigned interfaces.
A new QuickFix CodeAction can be used to insert interface stubs, if the compiler errors on one or more interface implementations are missing.
You can declare variables as a given interface to allow passing objects that implement the interface, and then call interface implementations on the passed object in a polymorphic manner.
Interfaces in AL (docs)