topic hubAL Developmentofficial - Microsoftreviewed - checked by Opus

Namespaces in AL

Namespaces in AL cover how AL code is grouped into logical units to avoid naming conflicts and allow object name reuse. The section answers questions about namespace declaration, using directives, nested namespaces, scope resolution, and how to adopt namespaces in existing code with tooling.

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

Overview

Namespaces in AL organize code into logical groups, prevent naming conflicts, and let the same object name be reused in different contexts. The concept page explains the core elements: declaring a namespace, the using directive, nested namespaces, and the scoping rules that resolve names.

The adoption page is for teams moving existing AL code to namespaces step by step. It describes automated code actions, namespace template resolution, sibling file analysis, a PowerShell script for adding namespaces in bulk, and sorting of using statements. It also covers fully qualified object references, which are supported from Business Central 2026 release wave 1.

Start with “Namespaces in AL” for the concepts and scoping rules. Then read “Adopting namespaces in AL” when you need to apply them to an existing codebase.

Key points

  • Namespaces group code logically and prevent naming conflicts.
  • Object names can be reused across different namespace contexts under defined scoping rules.
  • Core language elements: namespace declaration, using directive, nested namespaces, scope resolution.
  • Adoption can be progressive, not all at once.
  • Automated code actions add namespaces, using namespace template resolution and sibling file analysis.
  • A PowerShell script can add namespaces to many files in bulk.
  • Using statements can be sorted automatically.
  • Fully qualified object references are supported from Business Central 2026 release wave 1.

Learn pages

  • Adopting namespaces in AL: Learn about features, tools, and best practices for structuring and adopting namespaces in your AL code for Business Central.
  • Namespaces in AL: Namespaces in AL provide a way to organize your code into logical units and avoid naming conflicts.

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 2 Learn pages