bcquality/microsoft/knowledge/performance/avoid-user-interaction-in-transactions.md
Jesper Schulz-Wedde 0540c7bf6e Reframe seed-article banners as community contribution invitations
The 35 articles still in their seed form previously carried a banner
reading "Seed article. ... Domain stewards should expand, restructure,
and refine as needed." For a community preview, that phrasing reads as
"TODO left in production" to first-time visitors.

Replace all three banner variants (performance-seeded, security-seeded,
community-ported) with a single positive invitation:

> Contributions welcome — open a PR to refine or extend this article.

Content and structure of the articles are unchanged; only the leading
quote block differs. Articles that had their banner fully stripped in
the earlier triage pass (the showcase-grade ten) are unaffected.
2026-04-23 17:31:36 +02:00

1.1 KiB

bc-version domain keywords technologies countries application-area
all
performance
confirm
strmenu
message
transaction
dialog
al
w1
all

Do not prompt the user inside a write transaction

Contributions welcome — open a PR to refine or extend this article.

Description

Confirm, StrMenu, Message, and any other user-facing dialog pauses execution while the transaction is still open. During that pause every lock held by the transaction blocks other sessions. A user who walks away from the screen can suspend business-critical tables for an unbounded period.

Best Practice

Gather every user decision before the writing phase begins. Once the decisions are known, run the transaction end-to-end without prompts.

See sample: avoid-user-interaction-in-transactions.good.al.

Anti Pattern

Calling Confirm or StrMenu from inside an OnInsert, OnModify, or OnDelete trigger — or from any code path that has already started modifying records — blocks on user input while holding locks.

See sample: avoid-user-interaction-in-transactions.bad.al.