Running things in the background
Background processing in AL for Business Central: the job queue, page background tasks, and the task scheduler, plus operational limits for background sessions, child sessions and scheduled tasks. It helps answer which mechanism to use, how to set it up, and how errors and limits are handled.
- 7Learn pages
- 1subtopics
- 1videos
Path: Development > Programming in the AL language > Running things in the background · tier official · system development · narrative reviewed (checked by Opus)
Overview
This section covers the ways AL code can run work outside the user’s foreground session. Three mechanisms are described: the job queue, which lets end users schedule background jobs with recurring options; page background tasks, which run read-only computations for a page without blocking the user; and the task scheduler, which runs codeunits and reports at a specific date and time in a background session.
Start with the Async processing overview, which sets out the operational limits for background sessions, child sessions and scheduled tasks in online and on-premises environments. Then pick the page that matches your scenario: Job queue for user-scheduled and recurring jobs, Page Background Tasks for page responsiveness, and Task scheduler for programmatic scheduling with retry and failure handling. A subtopic holds the AL language reference pages (3 pages) for the related methods and types.
Key points
- The Async processing overview documents operational limits for background sessions, child sessions and scheduled tasks, online and on-premises.
- Job queue gives end users a way to schedule background jobs with recurring options. The page covers the job queue flow, dispatcher codeunit, error handler, parameter passing and permissions.
- Page Background Tasks run read-only computations or long processes asynchronously so pages stay responsive.
- Page background tasks use parent and child sessions, and take input through dictionary parameters.
- Page background tasks support timeout configuration, error levels (Ignore, Warning, Error), re-enqueuing and conditional cancellation.
- Task scheduler runs codeunits and reports at a set date and time in a background session.
- Task scheduler methods include CreateTask, SetTaskReady, TaskExists and CancelTask.
- Task scheduler handles retriable exceptions for transient errors and uses failure codeunits when a task fails.
Subtopics
More Learn pages
- Async processing Overview: Overview on the different ways an AL developer can do asynchronous (async) processing.
- Job queue: Learn about how the job queue works
- Page Background Tasks: Explains how to create page background tasks in Business Central.
- Task scheduler: Learn about scheduled tasks and how the task scheduler works.
Videos, posts and code changes
Linked by a Haiku matcher with a grounding quote from the item’s summary (link/topics.ts); machine-generated.
- #11257 Fix duplicate retention continuations for Waiting jobs (code change): “Fix duplicate retention continuations for Waiting jobs”
- #11262 Fix retention policy deletion-limit stop propagation (code change): “Fix retention policy deletion-limit stop propagation”
- #11890 Adding an in-product email storage cleanup (code change): “Scheduler proactively sends admins remediation steps”
- #11950 Adding an in-product email storage cleanup (backport to releases/29.x) (code change): “Adds codeunits for cleanup, a runner, a scheduler and inbox row deletion”
- #12117 [Job Queue] Clearer message and attempt number for runs interrupted by the platform (code change): “platform interrupts a job queue run, the log entry message now says”
- #9820 Use ReadCommitted isolation for CalcFields in Job Queue Entry GetXmlContent (code change): “Job Queue Entry GetXmlContent method now uses ReadCommitted isolation when reading”
- #148 Add Job Queue reliability and scheduling guidance (code change): “Require external side effects in Job Queue handlers to be idempotent”
- Background Page Tasks in Business Central Explained (community post): “Background page tasks enable pages to automatically refresh themselves”
- Dynamics 365 Business Central: the mistery around the “Parallel Session Management” codeunit. (community post): “Codeunit 490 is a manual, in-memory orchestrator using scope OnPrem procedures without async/await or platform-managed queues”
- If You Can’t Make It Fast, Make It Feel Fast (community post): “moving blocking work to the background instead of waiting for user input”
- 20260223 - If You Can’t Make It Fast, Make It Feel Fast (video): “background processing; job queue; page background task; task scheduler”
Source: Microsoft Learn (CC BY 4.0). Descriptions are Learn’s own.
What Learn documents here 7 Learn pages
- learnAsync processing Overview2023-10-04
- learnJob queue2023-12-18
- learnPage Background Tasks2021-04-01
- learnSession.StartSession(var Integer, Integer [, Text] [, var Record]) Method2026-10-01
- learnSession.StopSession(Integer [, Text]) Method2026-10-01
- learnTask scheduler2024-09-09
- learnTaskScheduler data type2026-10-01