topic hubAL Developmentofficial - Microsoftreviewed - checked by Opus

Interfaces

Interfaces in AL: how to declare them, implement them in codeunits, give methods default implementations, extend interfaces, and manage method changes over time. It answers questions about polymorphism, the is and as operators, and safely adding or removing interface methods in published extensions.

Path: Development > Programming in the AL language > Language elements > Interfaces · tier official · system development · narrative reviewed (checked by Opus)

Overview

Interfaces in AL define syntactical contracts that codeunits implement, which supports polymorphic programming. The section has four pages and no subtopics. They cover the basics, extension of interfaces, type testing and casting, and the lifecycle of interface methods.

Key points

  • Start with ‘Interfaces in AL’: interface declaration, the implements keyword, and Go to Implementations.
  • Interfaces can have default method implementations, and a default method can later transition to a required method.
  • ‘Extend interfaces in AL’ lets an interface extend other interfaces and inherit their methods (2024 release wave 2).
  • The is operator tests whether an interface supports a given interface or method, and the as operator casts it (2024 release wave 2).
  • Type testing and casting are mainly useful when extending interfaces.
  • Interface method lifecycle in published extensions uses Default, RequiredPending, and Obsolete states to keep backward compatibility.
  • The lifecycle page also covers required methods, a runtime identifier, and AppSourceCop rules.
  • The ‘Interfaces in AL’ page mentions 2023 release wave 1 and 2026 release wave 2 as version points.

Learn pages

Videos, posts and code changes

Linked by a Haiku matcher with a grounding quote from the item’s summary (link/topics.ts); machine-generated.

Source: Microsoft Learn (CC BY 4.0). Descriptions are Learn’s own.

What Learn documents here 4 Learn pages