Page.CancelBackgroundTask(Integer) Method
Version: Available or changed with runtime version 4.0.
Attempt to cancel a page background task.
Syntax
[Ok := ] Page.CancelBackgroundTask(TaskId: Integer)
Parameters
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.
Return Value
[Optional] Ok
Type: Boolean
true if the page background task was marked for cancellation; otherwise false.
Example
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.
Related information
Page Background Tasks
Page Data Type
System-Defined Variables
Get Started with AL
Developing Extensions