Learn how to design resilient Business Central AL transaction blocks using proper record locking order and automated retry patterns to handle SQL deadlocks gracefully.
Read articleLatest articles
Microsoft Dynamics 365 Business Central
Learn how to configure explicit read isolation in Business Central AL to prevent batch jobs from stalling on locked transaction records.
Read articleConsider a custom page extension on the customer card or sales order list that displays a real time calculated metric such as credit risk score or external partner balance.A common pattern is to write the calculation logic inside the OnAfterGetRecord or OnAfterGetCurrRecord page trigger. While functional, executing heavy calculation inside async page triggers blocks the…
Read articleConsider a batch process that evaluates 10,000 inbound integration lines against a pre-loaded reference dataset (such as cross-reference mapping or unit conversion factors). A common design pattern is to load the reference dataset into a temporary table (Record “Item Unit of Measure” temporary) and call TempUOM.Get (…) inside the processing loop. While functionally sound, querying…
Read articleImagine a night-end batch job that marks 2,000 processed staging records as archived or updates a custom processing flag across open sales lines.A common pattern is to fetch the record set, loop through with repeat…until, set the field value, and call Record.Modify(false).While setting RunTrigger to false bypasses AL event code, it still incurs a significant…
Read articleWhen generating PDFs, building zip archives, or parsing raw payloads in background tasks, working with “Temp Blob” is standard practice. However, handling streams carelessly can cause silent memory bloat and CPU spikes on the middle Tier. ⚠️ The Problem: Implicit Buffer Cloning.When a procedure accepts a “Temp Blob” codeunit or InStream variable by value (without…
Read articleDesigning a staging table with AutoIncrement = true on the primary key feels clean, no code, no fuss, keys assigned automatically.But under high frequency ingestion (IoT events, webhooks, logs), that simplicity turns toxic. Every insert competes for the same increment counter, creating lock contention at scale. The result? SQL insert timeouts and fragile throughput right…
Read articleA custom customer search API was timing out under load. Each lookup by name spiked SQL CPU to 100% and dragged query times from 50ms to 8+ seconds.The hidden culprit? Using SetFilter() with leading wildcards (@*text*). SQL Server can’t use the secondary index on Name when the filter starts with a wildcard, so the optimizer…
Read articleI audited a posting service where background job queues kept hitting lock timeouts during peak hours, even though transactions were short and indexes were tight.The hidden culprit? Developers were calling “Session.SetWorkDate()” inside loops. That adjustment leaks into the shared NST thread pool forcing cache invalidations and collisions on setup table locks. ⚠️ The Problem: The…
Read articleA nightly job was processing thousands of vendor PDF invoices. Halfway through, the job queue crashed with out of memory errors, destabilizing the middle tier.The hidden culprit? Retrieving MediaSet/Blob fields inside iterative loops. Each fetch silently allocates unmanaged buffer memory on the NST. Those allocations don’t release until the session ends, turning a clean routine…
Read article