IScheduledTask.CreateInvokeEvent

Fore Syntax

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

Fore.NET Syntax

CreateInvokeEvent(
                  Current: System.DateTime;
                  Options: integer;
                  Second: double
                  ): Prognoz.Platform.Interop.KeFore.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.

Fore 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.

Fore.NET Example

The requirements and result of the Fore.NET Example execution match with those in the Fore Example.

Imports Prognoz.Platform.Interop.KeFore;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Cont: IScheduledTasksContainer;
    Tasks: IMetabaseObjectDescriptors;
    Task: IScheduledTask;
    Invoke: IScheduledInvoke;
Begin
    
// Get current repository
    MB := Params.Metabase;
    
// 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, 00);
    Invoke.Invoke(MB);
End Sub

See also:

IScheduledTask