UseDynamicMailList: Boolean;
UseDynamicMailList: Boolean;
The UseDynamicMailList property determines whether recipient list is created dynamically to send results of task completion.
Available values:
True. Create recipient list dynamically. To create a list, use the macro implemented in the DynamicMailListModule Fore unit/form/assembly. The macro name is determined in the DynamicMailListMacro property.
False. Default value. Use a static list determined in the MailRecipients property.
Executing the example requires that the repository contains a scheduled tasks container with the TASK_CONTAINER identifier. Any task should be created in the container. A unit with the M_MAILLIST identifier should be also created in the repository, the unit implements the function to create the GetRecepients dynamical recipient list. The function has the following syntax:
Sub UserProc;
Var
MB: IMetabase;
Cont: IScheduledTasksContainer;
Task: IScheduledTask;
Props: IScheduledTaskProperties;
Begin
MB := MetabaseClass.Active;
Cont := MB.ItemById("TASK_CONTAINER").Bind As IScheduledTasksContainer;
Task := Cont.Tasks.Item(0).Edit As IScheduledTask;
Props := Task.Properties;
//Dynamic recipient list
Props.SendMail := True;
Props.UseDynamicMailList := True;
Props.DynamicMailListModule := MB.ItemById("M_MAILLIST");
Props.DynamicMailListMacro := "GetRecepients";
Props.MailTargetType := ScheduledTaskMailTarget.Personal Or ScheduledTaskMailTarget.Work;
(Task As IMetabaseObject).Save;
End Sub UserProc;
On executing the example parameters of task completion notification will be changed for the first task in the scheduled task container: recipient list will be created dynamically using the specified macro.
The requirements and result of the Fore.NET Example execution match with those in the Fore Example.
Imports Prognoz.Platform.Interop.KeFore;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Cont: IScheduledTasksContainer;
Task: IScheduledTask;
Props: IScheduledTaskProperties;
Begin
MB := Params.Metabase;
Cont := MB.ItemById["TASK_CONTAINER"].Bind() As IScheduledTasksContainer;
Task := Cont.Tasks.Item[0].Edit() As IScheduledTask;
Props := Task.Properties;
//Dynamic recipient list
Props.SendMail := True;
Props.UseDynamicMailList := True;
Props.DynamicMailListModule := MB.ItemById["M_MAILLIST"];
Props.DynamicMailListMacro := "GetRecepients";
Props.MailTargetType := ScheduledTaskMailTarget.stmtPersonal Or ScheduledTaskMailTarget.stmtWork;
(Task As IMetabaseObject).Save();
End Sub;
See also: