topic hubAL Developmentofficial - Microsoftunreviewed - model text not yet checked

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 rules that cause app validation failures. It answers questions about how to write, name, and retire AL code so it passes Marketplace submission.

Path: Development > Rules, guidelines, and best practices > Best practices > AL code · tier official · system development · narrative unreviewed (model text not yet checked)

Overview

This section collects the guidance for writing AL code in Business Central extensions. It has four pages and no subtopics. They cover general coding conventions, how to deprecate code, how to name objects with a prefix or suffix, and the rules that app validation enforces.

Start with “Best practices for AL code” for file naming, object naming, method declaration, variable naming, formatting, and line length. Then read “Prefix and suffix for naming in extensions” to see why an affix is needed to prevent name collisions and how it ties to Marketplace standards, affix registration, and AppSourceCop.

Use “Rules and guidelines for AL code” before you submit an app. It lists critical errors, important errors, and 14 common pitfalls behind validation failures. Use “Best Practices for Deprecation of AL Code” when you retire objects or members. It explains how Microsoft obsoletes code in the Base App, and you can follow the same pattern.

Key points

  • General conventions cover file naming, object naming, method declaration, variable naming, code formatting, and line length.
  • A prefix or suffix on extension object names prevents name collisions and is part of the Marketplace submission standards.
  • The affix page covers affix registration, namespaces, and the AppSourceCop check.
  • The rules page separates critical errors (encryption key function restrictions, sensitive data protection) from important errors.
  • 14 common pitfalls that cause app validation failures are listed, including prefix/suffix requirements, data classification, translation files, and permission sets.
  • Deprecation uses preprocessor directives and the ObsoleteState, ObsoleteTag, and ObsoleteReason properties.
  • The deprecation page describes CLEAN version symbols (CLEAN15 to CLEAN18) as the pattern Microsoft uses in the Base App.

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