topic hubAL Developmentofficial - Microsoftreviewed - checked by Opus

AL code

AL code best practices for Business Central extensions: naming conventions, file structure, formatting, deprecation with obsolete attributes and CLEAN symbols, prefix and suffix rules, and validation rules for Marketplace submission. It answers how to write, name, and retire AL code consistently.

Path: Development > Rules, guidelines, and best practices > Best practices > AL code · tier official · system development · narrative reviewed (checked by Opus)

Overview

This section collects guidance for developers writing AL code in extensions. It covers day-to-day style (file and object naming, method declarations, variable naming, formatting, line length) and the rules an extension must meet when submitted to Marketplace.

The pages fit together by topic. The general best practices page sets the coding conventions. The prefix and suffix page explains how to register and use an affix so object names do not collide, and how AppSourceCop relates to it. The deprecation page shows how to retire code with obsolete properties and preprocessor directives, following the pattern Microsoft uses in the Base App. The rules and guidelines page lists critical and important validation requirements and common pitfalls.

Start with the general best practices page for conventions, then read the rules and guidelines page if you plan to submit to Marketplace. Use the prefix/suffix and deprecation pages when you name new objects or remove existing ones.

Key points

  • Best practices page covers file naming, object naming, method declaration, variable naming, code formatting, and line length.
  • Deprecation uses the ObsoleteState, ObsoleteTag, and ObsoleteReason properties together with preprocessor directives.
  • CLEAN version symbols (CLEAN15 to CLEAN18) are used in the deprecation guidance, matching how Microsoft obsoletes Base App code.
  • A prefix or suffix on extension objects prevents name collisions and is needed for Marketplace submission standards.
  • Affix registration and AppSourceCop are part of the prefix and suffix guidance.
  • Rules and guidelines page lists critical and important validation requirements for Marketplace submissions.
  • Rules topics include encryption, data classification, permission sets, translation, application area, and prefix/suffix.

Learn pages

Videos, posts and code changes

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