With the release of AL version 17.0, Microsoft extended support for namespaces and fully qualified names. This enhancement marked a significant step forward in the evolution of AL, providing developers with a more structured and modern way to reference objects in Business Central.

Background

Prior to version 17.0, developers primarily relied on object IDs or simple names when running codeunits, pages, reports, or working with tables. As solutions grew in complexity and multiple extensions were deployed side by side, the risk of naming collisions increased. The introduction of namespaces addressed this challenge by allowing developers to organize objects into logical groups and reference them unambiguously using fully qualified names.

New Method Overloads in AL 17.0

AL 17.0 introduced new overloads for several methods, enabling execution by fully qualified names:

  • Codeunit
    • Codeunit.Run('MyNamespace.CodeunitName');
  • Page
    • Page.Run('MyNamespace.PageName');
    • Page.RunModal('MyNamespace.PageName');
  • Report
    • Report.Run('MyNamespace.ReportName');
    • Report.RunModal('MyNamespace.ReportName');
    • Report.Execute('MyNamespace.ReportName', 'foo', rec);
  • RecordRef
    • recRef.Open('MyNamespace.TableName');

This functionality allows developers to run or open objects directly by their namespace-qualified names, reducing reliance on numeric IDs and improving clarity.

Example Implementation

The following example demonstrates how these overloads can be used:

codeunit 10 MyCodeunit
{
    procedure MyProcedure()
    var
        rec: Record Customer;
        recRef: RecordRef;
    begin
        // Run codeunit by fully qualified name
        Codeunit.Run('MyNamespace.CodeunitName');

        // Page methods by fully qualified name
        Page.Run('MyNamespace.PageName');
        Page.RunModal('MyNamespace.PageName');

        // Report methods by fully qualified name
        Report.Run('MyNamespace.ReportName');
        Report.RunModal('MyNamespace.ReportName');
        Report.Execute('MyNamespace.ReportName', 'foo', rec);

        // Load record by fully qualified name
        recRef.Open('MyNamespace.TableName');
    end;
}

FullyQualifiedName Property

AL 17.0 also introduced the FullyQualifiedName property for both Record and RecordRef instances. This property exposes the exact namespace-qualified identity of the object, which is particularly useful for diagnostics, logging, and dynamic object handling.

Example:

codeunit 10 MyCodeunit
{
    procedure MyProcedure()
    var
        rec: Record Customer;
        recRef: RecordRef;
    begin
        Message(rec.FullyQualifiedName);
        Message(recRef.FullyQualifiedName);
    end;
}

Conclusion

With the extended support for namespaces and fully qualified names introduced in AL version 17.0, Business Central development takes a decisive step toward greater modularity, clarity, and scalability.

Categorized in: