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.
- 45Learn pages
- 4subtopics
- 1videos
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
- Variables, types, and operators (8 pages)
- Objects (16 pages)
- Preprocessor directives in AL (3 pages)
- Code analysis (7 pages)
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.
- What’s New: AL Language (2025 release wave 1) (video): “AL Language; resources; pages; reports; strings; json; yaml”
Source: Microsoft Learn (CC BY 4.0). Descriptions are Learn’s own.
What Learn documents here 8 of 45 Learn pages
- learnAL complex types2024-03-01
- learnAL control statements2025-03-26
- learnAL development environment reference overview2025-05-14
- learnAL error handling2024-03-01
- learnAL operators2024-09-18
- learnAL Preprocessor Directives Overview2026-10-05
- learnAL simple statements2025-01-24
- learnAL type conversion in expressions2025-02-07
Show 32 more
- learnAL variables2024-04-26
- learnAppSourceCop analyzer2026-10-01
- learnArithmetic operators2024-07-01
- learnBoolean operators2024-07-01
- learnCodeCop analyzer2026-10-01
- learnCodeunit object2025-05-19
- learnControl add-in object2025-03-20
- learnEntitlement object2025-03-19
- learnExtensible Enums2025-05-21
- learnFAQ for Developing in AL2025-06-16
- learnPage customization object2025-08-19
- learnPage extension object2024-11-13
- learnPage object2024-04-26
- learnPermission Set Extension Object2025-06-02
- learnPermission set object2025-06-02
- learnPerTenantExtensionCop analyzer2026-10-01
- learnPragma Directives in AL Overview2026-10-05
- learnProfile object2024-09-30
- learnProgramming in AL2025-01-16
- learnProtected variables2024-05-24
- learnQuery object2024-11-22
- learnRegion Directives for Organizing AL Code2026-10-05
- learnRelational operators2024-04-26
- learnReport object2024-09-16
- learnRuleset for the code analysis tool2022-06-24
- learnSystem-defined variables2024-04-26
- learnTable extension object2024-04-17
- learnTable keys2026-09-22
- learnTable object2026-06-12
- learnUICop analyzer2026-10-01
- learnUsing Access Modifiers in AL2022-09-27
- learnUsing the code analysis tool2026-08-25