
The introduction of namespaces in the Business Central 2023 release wave 2 marks a turning point for developers working with the AL language.
This new functionality radically changes how we organize and manage our code, offering a more efficient way to structure it and avoiding the dreaded naming conflicts.
What Are Namespaces and Why Are They Important?

Namespaces (or name spaces) are logical containers that allow you to group and structure your code hierarchically.
This feature eliminates the need to use repetitive prefixes in custom objects, solving a common issue: maintaining different objects with the same name within a solution, as long as they belong to different namespaces.
Main Advantages of Using Namespaces:
- They make modular code organization easier
- They eliminate the need for redundant prefixes
- They resolve naming conflicts between objects
- They provide greater clarity to the project structure
- They allow you to logically group related functionalities
Fundamental Rules of Namespaces
Uniqueness Rules
- There can only be one object of a specific type with the same name within a module.
- Within a namespace, only one object of a specific type can have a given name.
- Each object can belong to only one namespace.
Syntax Rules
- The namespace must be globally unique
- The recommended structure is: {Organization}.{Product}.{FunctionalArea}
- Use stable, non‑versioned names (renaming a namespace is a breaking change)
- The name may contain any valid AL identifier and dots to indicate hierarchy
- Practical Implementation
Basic Example: Creating a Custom Table

Working with Duplicate Objects
It is possible to create objects with the same name as standard objects, as long as they are in different namespaces. For example:

Managing References Between Namespaces
When we need to work with objects from different namespaces, we have two options:
- Using Directives

- Full Reference
![]()
Automation with PowerShell
Microsoft provides a PowerShell script to assign multiple namespaces within specific folders. Here’s how to use it:
- Create a CSV file with the following structure:

- Run the PowerShell script:

- Script Considerations
- Verify that no namespaces exist before running the script
- The script will add the namespace at the beginning of each .al file in the specified folders
- Make sure to create a backup before running the script
Best Practices for Using Namespaces in Business Central
- Consistent Structure:
-
- Maintain a logical hierarchy in your namespaces
- Use descriptive names that reflect the functionality
- Reference Management:
-
- Prefer using directives to improve readability
- Use full references only when necessary to avoid ambiguity
- Code Organization:
-
- Group related objects within the same namespace
- Keep a folder structure that mirrors your namespace structure
- Documentation:
-
- Document the structure of your namespaces
- Keep a record of dependencies between namespaces
Conclusion
Namespaces in Business Central represent a significant step forward in how AL code is organized and maintained.
Their implementation not only improves code structure but also facilitates team collaboration and the management of complex projects. By following the rules and best practices described above, you can make the most of this powerful feature to create more robust and maintainable solutions.
It is important to remember that transitioning to namespaces may require careful planning, especially in existing projects. However, the long‑term benefits in terms of maintainability and code clarity make the initial effort worthwhile
You can find more information about namespaces in the following Microsoft article
Custom Solutions and Business Central Support with ABD

At ABD, we specialize in delivering advanced and customized solutions to optimize the use of Business Central in your company.
Our team of experts is available to help you implement and fully leverage the innovative capabilities of Business Central. Feel free to contact us to receive specialized guidance and support.
Contact us for more information and personalized assistance.