IScheduledTask.CreateInvokeEvent

Syntax

CreateInvokeEvent(
                  Current: DateTime;
                  [Options: Integer = 0;]
                  [Second: Double = 0]
                  ): IScheduledInvoke;

Parameters

Current. The date and time of the operation execution.

Options. Parameter is not supported.

Second. Parameter is not supported.

Description

The CreateInvokeEvent method creates a new event of executing a task of the scheduled tasks container.

Comments

It is necessary to set permission on the execution and set the schedule to create the event successfully.

Example

Executing the example requires that the repository has a scheduled tasks container with the SCHEDULEDTASKSCONTAINER identifier.

Add links to the Fore, Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    Cont: IScheduledTasksContainer;
    Tasks: IMetabaseObjectDescriptors;
    Task: IScheduledTask;
    Invoke: IScheduledInvoke;
Begin
    
// Get current repository
    MB := MetabaseClass.Active;
    
// Get the first task in container
    Cont := MB.ItemById("SCHEDULEDTASKSCONTAINER").Bind As IScheduledTasksContainer;
    Tasks := Cont.Tasks;
    Task := Tasks.Item(
0).Bind As IScheduledTask;
    
// Create a task execution event
    Invoke := Task.CreateInvokeEvent(DateTime.Now);
    Invoke.Invoke(MB);
End Sub UserProc;

After executing the example, task execution event is created for the first task in the container. A corresponding record will be added to the task history.

See also:

IScheduledTask