title | description | ms.author | ms.date | ms.tgt_pltfrm | ms.topic | author |
---|---|---|---|---|---|---|
Page.CancelBackgroundTask(Integer) Method |
Attempt to cancel a page background task. |
solsen |
02/26/2024 |
na |
reference |
SusanneWindfeldPedersen |
Version: Available or changed with runtime version 4.0.
Attempt to cancel a page background task.
[Ok := ] Page.CancelBackgroundTask(TaskId: Integer)
Page
Type: Page
An instance of the Page data type.
TaskId
Type: Integer
Specifies the ID of the page background task to cancel. The ID is assigned to the task when it is queued by the EnqueueBackgroundTask method.
[Optional] Ok
Type: Boolean
true if the page background task was marked for cancellation; otherwise false.
The following example uses the CancelBackgroundTask method to cancel an existing page background task, based on its task ID.
var
WaitTaskId: Integer;
trigger OnAfterGetRecord()
var
TaskParameters: Dictionary of [Text, Text];
begin
if (WaitTaskId > 0) then
Currpage.CancelBackgroundTask(WaitTaskId);
TaskParameters.Add('Wait', '1000');
CurrPage.EnqueueBackgroundTask(WaitTaskId, 50100, TaskParameters, 1000, PageBackgroundTaskErrorLevel::Warning);
end;
CurrPage is a system-defined variable. For more information, see System-Defined Variables.
Page Background Tasks
Page Data Type
System-Defined Variables
Get Started with AL
Developing Extensions