Understanding page background tasks
Dynamics 365 Business Central version 15 introduces a new feature to handle asynchronous programming called page background tasks. Page background tasks permit you to define a read-only and long-running process on a page that can be executed asynchronously in a background thread (isolated from the parent session). You can start the task and continue working on the page without waiting for the task to complete. The following diagram (provided by Microsoft) shows the flow of a background task:
A page background task has the following properties:
- It's a read-only session (it cannot write or lock the database).
- It can be canceled and it has a default and maximum timeout.
- Its lifetime is controlled by the current record (it is canceled when the current record is changed, the page is closed, or the session ends).
- Completion triggers are invoked on the page session (such as updating page records and refreshing the UI).
- It can be queued up.
- The parameters...