Succeeded: Boolean;
The Succeeded property returns whether the task is successfully executed. If the property returns True, the task is successfully executed, else the task is executed with error.
Executing the example requires that the repository contains a scheduled tasks container with the TASK_CONTAINTER identifier.
Sub UserProc;
Var
MB: IMetabase;
Cont: IScheduledTasksContainer;
Tasks: IMetabaseObjectDescriptors;
Task: IScheduledTask;
Results: IScheduledTaskResults;
Result: IScheduledTaskResult;
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("Finished with error");
End If;
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 and also the result of execution (Finished successfully/with error) are displayed.
See also: