bcquality/microsoft/knowledge/events/prefix-temporary-record-event-parameters-with-temp.md
Jesper Schulz-Wedde b6da405376 Improve partner onboarding and documentation navigation
Lead with a complete plugin quick start and add task-oriented usage, troubleshooting, customization, and contribution guides. Preserve the broader plugin framing, correct conflicting contract guidance, support Agents folder reviews, and align repository validation. Convert existing sample references to clickable links without changing knowledge rules.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-09 17:25:29 +02:00

1.8 KiB

bc-version domain keywords technologies countries application-area
all
events
temporary-record
naming
event-parameters
buffer
temp-prefix
integration-event
conventions
al
w1
all

Prefix temporary record event parameters with Temp

Description

When a record passed to an event is a temporary record — an in-memory buffer not persisted to the database — its parameter name must start with Temp. The prefix is the only reliable signal a subscriber has that writes to the record will not reach the database and that the data is scoped to the current call. Without it, subscribers may treat buffer data as persisted: calling Modify or Insert expecting durability, or reading it as the authoritative table, which leads to silent data loss and confusing behaviour. The temporary keyword sits on the variable declaration and is not visible at the subscriber, so the name has to carry the meaning.

Best Practice

Name temporary record parameters with a Temp prefix, for example var TempSalesLineBuffer: Record "Sales Line" temporary, so every subscriber sees immediately that the record is an in-memory buffer and treats writes accordingly.

See sample: prefix-temporary-record-event-parameters-with-temp.good.al.

Anti Pattern

A temporary record parameter named without the Temp prefix (var SalesLineBuffer: Record "Sales Line" temporary), so subscribers cannot tell the record is non-persistent and may rely on writes that are silently discarded. Detection: an event parameter declared temporary whose name does not start with Temp.

See sample: prefix-temporary-record-event-parameters-with-temp.bad.al.