The list of configured events is set on the Custom Metadata > Events tab in the Parameters dialog box.
NOTE. Event setup is available for the users included in the Administrators group.
The following operations are available on the tab:
Event occurrence is traced with task scheduler interface is used to work with the events collection. In this case the task container specified in task scheduler settings should contain tasks run on occurring the configured event.
An event may occur after executing a task if the corresponding setup is created for it. An event can also be generated from application code. The IMetabaseCustomForeEvents interface is used to work with the events collection. To generate an event, get its description by means of properties or methods of the specified interface, and execute the IMetabaseCustomForeEvent.Invoke method.
The example of generating event named Loading Start. If on executing the example the task scheduler is run, and the container, with which the task scheduler works, has tasks started on executing this event, they will be executed. To execute the example, add a link to the Metabase system assembly.
Sub InvokeEvent;
Var
MB: IMetabase;
CustomClassExtender: IMetabaseCustomExtender;
Events: IMetabaseCustomForeEvents;
ForeEvent: IMetabaseCustomForeEvent;
Begin
// Get repository
MB := MetabaseClass.Active;
// Get container of custom classes
CustomClassExtender := Mb.SpecialObject(MetabaseSpecialObject.CustomExtender).Edit As IMetabaseCustomExtender;
// Get list of events
Events := CustomClassExtender.Events;
ForeEvent := Events.FindByName("Loading start");
// Generate event
ForeEvent.Invoke;
End Sub InvokeEvent;
See also: