IScheduledTaskCustomAlert.EventId

Fore Syntax

EventId: String;

Fore.NET Syntax

EventId: string;

Description

The EventId property determines the event, on occurring of which the task is executed.

Comments

The event must be determined on the Custom Metadata > Events tab of the dialog of repository parameters setup.

Fore Example

Executing the example requires:

Task settings must be determined on the Scheduletab :

Add links to the Metabase, Fore system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    cont: IScheduledTasksContainer;
    task: IScheduledTask;
    prop: IScheduledTaskProperties;
    alerts: IScheduledTaskAlerts;
    EventId: String;
    alert: IScheduledTaskAlert;
    CustomAlert: IScheduledTaskCustomAlert;
Begin
    MB := metabaseClass.Active;
    cont := MB.ItemById("TASK_CONTAINER").Edit As IScheduledTasksContainer;
    task := cont.Tasks.Item(0).Edit As IScheduledTask;
    prop := task.Properties;
    alerts := prop.Alerts;
    EventId := prop.EventId;
    EventId := "CUSTOM_EVENT";
    alert := alerts.Add(ScheduledTaskAlertType.Custom);
    CustomAlert := alert As IScheduledTaskCustomAlert;
    CustomAlert.EventId := EventId;
    (task As IMetabaseObject).Save;
End Sub UserProc;

After executing the example the After Custom Event option of task execution frequency is set for the task, and the Start Download event is selected.

Fore.NET Example

The requirements and result of the Fore.NET Example execution match with those in the Fore Example. Connect the KeFore system assembly instead of the Fore system assembly.

Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.KeFore;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    cont: IScheduledTasksContainer;
    task: IScheduledTask;
    prop: IScheduledTaskProperties;
    alerts: IScheduledTaskAlerts;
    EventId: String;
    alert: IScheduledTaskAlert;
    CustomAlert: IScheduledTaskCustomAlert;
Begin
    MB := Params.Metabase;
    cont := MB.ItemById["TASK_CONTAINER"].Edit() As IScheduledTasksContainer;
    task := cont.Tasks.Item[0].Edit() As IScheduledTask;
    prop := task.Properties;
    alerts := prop.Alerts;
    EventId := prop.EventId;
    EventId := "CUSTOM_EVENT";
    alert := alerts.Add(ScheduledTaskAlertType.statCustom);
    CustomAlert := alert As IScheduledTaskCustomAlert;
    CustomAlert.EventId := EventId;
    (task As IMetabaseObject).Save();
End Sub;

See also:

IScheduledTaskCustomAlert