topic hubAL Developmentofficial - Microsoftreviewed - checked by Opus

The AL programming language

The AL programming language section covers language fundamentals for Business Central extensions: statements, methods, types, error handling, labels, access modifiers, and XML comments. It also links to subtopics on variables and operators, object types, preprocessor directives, and code analysis. It answers syntax, behavior, and how-to-write-AL questions.

Path: Development > The AL programming language · tier official · system development · narrative reviewed (checked by Opus)

Overview

This section documents the AL language used to build Business Central extensions. The core pages explain programming basics (variable declarations, triggers, code reuse), the statement types (simple statements and control statements), and how to declare and call methods, including return values and complex return types. Further pages cover cross-cutting topics: error handling with error dialogs, try methods, error collection and telemetry; labels for translatable text; access modifiers for controlling visibility; and XML comments for IntelliSense and generated documentation. A reference overview page lists the objects, properties, triggers, attributes, and methods available, and an FAQ covers setup, debugging, and Marketplace validation. Start with “Programming in AL” for the fundamentals, then move to the subtopics: variables, types and operators; objects; preprocessor directives; and code analysis.

Key points

  • Programming in AL covers variable declarations, protected variables, trigger types, code reuse, and security patterns.
  • Control statements include if-then-else, case, for, foreach, while, repeat-until, plus break and continue.
  • Simple statements are assignment, method, and AssertError statements, including compound assignment operators.
  • Methods can have local or global scope, parameters, return values, and attributes; complex types let procedures return records or built-ins like HttpClient and HttpResponseMessage.
  • Error handling covers error dialogs, try methods, error collection, telemetry, the ErrorInfo data type, and error message quality.
  • Access modifiers are internal, local, protected, and public, with an internalsVisibleTo setting, applied at compile time.
  • Labels provide translatable string constants with Comment, Locked, and MaxLength parameters for captions, tooltips, and messages.
  • Subtopics cover variables and operators (8 pages), object types (16 pages), preprocessor directives (3 pages), and code analysis (7 pages).

Subtopics

More Learn pages

  • AL complex types: With AL complex types, you can return most types from procedures in AL for Business Central
  • AL control statements: Compound, conditional, and repetitive control statements in AL for Business Central.
  • AL development environment reference overview: Overview of the objects in the AL Language development environment.
  • AL error handling: Deal with unexpected situations that occur when code is run in AL for Business Central.
  • AL simple statements: Describes the simple, single-line statements in AL for Business Central with examples
  • FAQ for Developing in AL: Overview of frequently asked questions for development using the AL language.
  • Programming in AL: AL is the programming language used for manipulating data such as retrieving, inserting, and modifying records in a Business Central database. It controls the execution of the various application objects, such as pages, reports, or codeunits.
  • Using Access Modifiers in AL: Describes how the AL access modifiers can be used in code.
  • Working with AL methods: Methods also known as procedures are a fundamental programming element in AL for Business Central.
  • Working with Labels in AL for Business Central: Learn how to work with labels in AL, the translatable string constants that Business Central displays as captions, descriptions, and messages.
  • XML comments in code: Learn about adding documentation to AL code by including XML elements in a special syntax.

Videos and posts

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 8 of 45 Learn pages

Show 32 more