IScheduledTaskResult.NotificationSended

Syntax

NotificationSended: TriState;

Description

The NotificationSended property returns whether electronic message is sent after task execution.

Comments

Available values:

Example

Executing the example requires a scheduled tasks container with the TASK_CONTAINER identifier and a task used to calculate regular report.

Add links to the Metabase, Fore system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    Cont: IScheduledTasksContainer;
    Tasks: IMetabaseObjectDescriptors;
    Task: IScheduledTask;
    Results: IScheduledTaskResults;
    Result: IScheduledTaskResult;
    res, i: Integer;
Begin
    MB := MetabaseClass.Active;
    Cont := MB.ItemById("TASK_CONTAINTER").Bind As IScheduledTasksContainer;
    Tasks := Cont.Tasks;
    Task := Tasks.Item(0).Bind As IScheduledTask;
    Results := Task.GetResults;
    For i := 0 To Results.Count - 1 Do
        Result := Results.Item(i);
        Debug.Write(Result.StartDateTime.ToString + " | ");
        Debug.Write(Result.FinishDateTime.ToString + " | ");
        If Result.Succeeded Then
            Debug.WriteLine("Successfully completed");
        Else Debug.WriteLine("Completed with error");
        End If;
        Select Case Result.NotificationSent
            Case TriState.OffOption:
                Debug.WriteLine("Electronic message is not sent");
            Case TriState.OnOption:
                Debug.WriteLine("Electronic message is sent");
            Case TriState.Undefined:
                Debug.WriteLine("Results of task execution are reset to default");
        End Select;
    End For;
End Sub UserProc;

After executing the example the history of the executing of first task in the scheduled tasks container is displayed in the development environment console. Date and time of the start and completion of task execution, result of execution, and also information about whether electronic message is sent or not, are displayed.

See also:

IScheduledTaskResult