BCQuality rule · styleAL Developmentofficial - Microsoftderived - from the source, no model text

Prefix temporary record variables with `Temp`

A Record variable declared with the temporary modifier behaves nothing like a normal record variable: it never touches the database, holds rows only for the lifetime of the variable, and is not visible to filters or queries on the underlying table.

Rule on GitHub · microsoft layer · style · BC all · tier official · derived

Description

A Record variable declared with the temporary modifier behaves nothing like a normal record variable: it never touches the database, holds rows only for the lifetime of the variable, and is not visible to filters or queries on the underlying table. The BC convention is to make that difference visible at every call site by prefixing the variable name with Temp — TempJobWIPBuffer, TempSalesLine, TempIntegerBuffer. The convention is load-bearing for code review: when a reader sees SalesLine.Insert(), they expect a database write; when they see TempSalesLine.Insert(), they know it is an in-memory buffer.

Best Practice

Every local or global variable of type Record X temporary must start with Temp. Ordinary procedure parameters follow the same convention. Event publisher parameters are owned by the events-domain rule prefix-temporary-record-event-parameters-with-temp.md; the style leaf must not emit a second finding for the same event parameter.

See sample: temporary-variable-temp-prefix.good.al.

Anti Pattern

WIPBuffer: Record "Job WIP Buffer" temporary; as a local, global, or ordinary procedure parameter reads at the call site as if it were a database operation. Exclude event publisher parameters here so the events leaf remains their single owner.

See sample: temporary-variable-temp-prefix.bad.al.

Examples

Changed by


From microsoft/BCQuality at a4593a1, MIT License, Copyright (c) 2026 Microsoft Corporation (license).