Procedure-local Labels are valid
The AL language supports Label variables at both object and procedure scope. Microsoft documents the Label data type without imposing an object-scope requirement, and the translation pipeline generates an XLF file containing all labels used by the extension.
- microsoftlayer
- styledomain
- 0examples
- 1pull request
Rule on GitHub · microsoft layer · style · BC all · tier official · derived
Description
The AL language supports Label variables at both object and procedure scope. Microsoft documents the Label data type without imposing an object-scope requirement, and the translation pipeline generates an XLF file containing all labels used by the extension. There is no documented correctness or localization defect caused solely by declaring a Label in a procedure-local var block.
Best Practice
Choose object scope when a Label is reused or when an established repository convention prefers central declarations; choose procedure scope when the Label belongs to one procedure. Do not report a correctness or localization finding solely because a Label is local. An explicit object-scope convention is at most a low-severity maintainability preference. This guidance applies equally to production and test apps: test code still needs localization where its strings are user-facing or translator-facing.
Changed by
- #132 Refine self-improvement review guidance, 2026-09-03
From microsoft/BCQuality at a4593a1, MIT License, Copyright (c) 2026 Microsoft Corporation (license).