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

29 lines
1.1 KiB
Markdown

---
bc-version: [all]
domain: performance
keywords: [confirm, strmenu, message, transaction, dialog]
technologies: [al]
countries: [w1]
application-area: [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`.