Today I would like to share some information on best practices for AL File naming.
AL is the programming language that is used for manipulating data such as retrieving, inserting, and modifying records in a Dynamics 365 Business Central database. It controls the execution of the various application objects, such as pages, reports, or codeunits. All AL Codes are written in AL files, so before adding AL Codes, we must first create AL files.
As you might know, all file systems follow the same general naming conventions for an individual file: a base file name and an optional extension, separated by a period. For AL file, the filename is FileName.al.
Here are the best practices suggested by Microsoft.
File naming notation:
Follow the syntax for file naming as shown in the table:
|Permission Set Extension||PermissionSetExt|
|Object name||File name|
|codeunit 70000000 MyPrefixSalesperson|
|page 70000000 MyPrefixSalesperson|
|pageextension 70000000 MyPrefixSalesperson extends “Customer Card”|
Let’s look at a few specific examples.
table 21 “Cust. Ledger Entry” -> CustLedgerEntry.Table.al
page 21 “Customer Card” -> CustomerCard.Page.al
report 1306 “Standard Sales – Invoice” -> StandardSalesInvoice.Report.al
pageextension 9206 “User Personalization” extends “User Personalization” -> UserPersonalization.PageExt.al
So each file name has object names with only characters [A-Za-z0-9], object type, and dot al, for file type. In your extension, the name of each new application object (table, page, codeunit), can contain a prefix or suffix.
The CodeCop analyzer suggests that the object name is part of the file name, which is encouraged as a best practice. Adding any affixes to the file names is voluntary.
The file DocumentAttachmentDetails.al has an incorrect name. The valid name is RenameDialog.Page.al.
1. The file name can be changed at any time and this is not a breaking change.
2. In addition to file names, you can also create folders to manage AL files, Microsoft base application is categorized by function, you can also create folders based on object types, there is no restriction on this.
3. If you are submitting an app to AppSource, you must follow the guidance in the Technical Validation Checklist.
6. You can find more about Best Practices for AL in MS Learn (Docs)
7. You can use waldo’s CRS AL Language Extension to change all file names at once.
The last thing I want to share is that these best practices has actually changed in the past, it wasn’t in this format before. (Of course it is no longer recommended)
Old File naming notation:
Old File naming examples:
|Object Name||File Name|
Old Type map:
Hope this will help.
Thanks for reading.