Bewerken

Delen via


OnPageBackgroundTaskCompleted (Page) trigger

Version: Available or changed with runtime version 4.0.

Runs after a page background task has successfully completed.

Syntax

trigger OnPageBackgroundTaskCompleted(TaskId: Integer; Results: Dictionary of [Text,Text])
begin
    ...
end;

Parameters

TaskId
 Type: Integer
Specifies the ID of the background task that was run. The ID is automatically assigned to the background task when it is created.

Results
 Type: Dictionary of [Text,Text]
Specifies the results of the page background task.

Remarks

The callback triggers can't execute UI operations, except notifications and control updates. This means that, for example, CurrPage.Update() statements are ignored because they would in many cases lead to infinite loops when page background tasks are started from the OnAfterGetCurrRecord trigger.

Example

The following example modifies the OnPageBackgroundTaskCompleted trigger to update the page with the started and finished times that were calculated in the page background task, and displays a notification that the times have been updated. For more details about this example, see Page Background Tasks.

    trigger OnPageBackgroundTaskCompleted(TaskId: Integer; Results: Dictionary of [Text, Text])
    var
        started: Text;
        waited: Text;
        finished: Text;
        PBTNotification: Notification;
    begin
        if (TaskId = WaitTaskId) then begin
            Evaluate(started, Results.Get('started'));
            Evaluate(waited, Results.Get('waited'));
            Evaluate(finished, Results.Get('finished'));

            before1 := started;
            duration1 := waited;
            after1 := finished;
            PBTNotification.Message('Start and finish times have been updated.');
            PBTNotification.Send();
        end;
    end;

Get Started with AL
Developing Extensions
OnPageBackgroundTaskCompleted (Page Extension) Trigger