ObjectKey: Integer;
The ObjectKey property determines key of repository object.
To determine identifier of repository object, use the IScheduledTaskAuditAlert.ObjectId property.
Executing the example requires:
Scheduled tasks container with the TASK_CONTAINER identifier that contains a task.
Repository object with the 13911 key.
Task settings must be determined on the Schedule tab:
The Perform Task checkbox is selected.
The None option of task performing frequency is selected.
Add links to the Metabase, Fore system assemblies.
Sub UserProc;
Var
MB: IMetabase;
cont: IScheduledTasksContainer;
task: IScheduledTask;
prop: IScheduledTaskProperties;
alerts: IScheduledTaskAlerts;
alert: IScheduledTaskAlert;
AuditAlert: IScheduledTaskAuditAlert;
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;
alerts.Clear;
alert := alerts.Add(ScheduledTaskAlertType.Audit);
AuditAlert := alert As IScheduledTaskAuditAlert;
AuditAlert.ObjectKey := 13911;
AuditAlert.Operation := 2097152; // Save data
AuditAlert.Result := ScheduledAlertAuditResult.Succeeded;
AuditAlert.UserName := "UserName";
AuditAlert.Station := "Station";
AuditAlert.UserNameOS := "UserNameOS";
(task As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the After System Event task performing frequency option is set, and the following parameters are set:
The repository object that generates the event is selected by the specified key.
The task that generates the Save Data event.
Task execution result is successful.
The repository user and operating system user who generate the event.
The workstation used to generate the event is set.
See also: