In this article:
To set up task execution result handling options, use the Result tab in the task parameters setup dialog box.
To open dialog to set up task parameters, create new or open ready task:
The following result handling options are available for all tasks:
Sending a notification by email.
Calling a custom event.
The following additional result handling options are available for regular report calculation task:
Publishing on the SharePoint web site.
Publishing to FTP server.
Printing.
File format.
NOTE. For the report sent by email and/or published to a FTP server the following formats are available: XLSX, XLS, PDF, RTF, HTM, ODS, EMF, PPREPORT.
To set up automatic sending of notification about task execution to email, select the Notify by Email checkbox and select the option of recipients adding:
Recipient List. To select a list of emails, users or group of users to whom the report about task execution will be sent, follow the steps:
Specify a list of emails to which notification will be sent. Put semicolon after each email.
Click the Select button to search security subjects. The Select users and groups dialog box opens.
Dynamic Recipient List. To create a list of recipients by condition, follow the steps:
Select the Dynamic Recipient List radio button on the Result tab of the dialog for task execution parameters setting.
In the Unit box specify the object containing implementation of the function for handling recipient list.
In the Function drop-down list select the function for handling recipient list.
NOTE. The list shows only functions with the signature: Function <name>(<param>: IScheduledTask): IArrayList.
Notification Settings. After executing the task the notification with specified parameters of email is sent to specified addresses. The status of sending notifications will be displayed in the workspace of the container in the Notification column.
IMPORTANT. On setting up email sending the configuration file must contain description of the <HOST> section, otherwise emails will not be sent.
To execute the example, add links to the Collection, Metabase system assemblies.
Public Function GetRecepients(Task: IScheduledTask):IArrayList;
Var
List: IArrayList;
Mb: IMetabase;
MS: IMetabaseSecurity;
SSS: ISecuritySubjects;
SS: ISecuritySubject;
Begin
Mb := Metabaseclass.Active;
MS := MB.Security;
SSS := MS.AllUsers;
// Platform user:
SS := SSS.Item(9);
Select Case (Task.State As Integer)
// Task is successfully executed:
Case 3:
List := New ArrayList.Create;
List.Add("user1@examle.com");
List.Add(MS.ResolveSid(SS.Sid));
// Task is executed with error:
Case 4:
List := New ArrayList.Create;
List.Add("user2@examle.com");
List.Add(MS.ResolveSid(SS.Sid));
End Select;
Return List;
End Function GetRecepients;
Determine created module in the Module field on the Result tab in the task parameters setting dialog box. Enter GetRecepients in the Function box.
On executing the task, for which email notification is set up with the use of dynamic recipient list, notification is sent. Delivery address depends on the current task status.
To set up custom event execution after the task calculation, follow the steps:
Select the Call Event checkbox.
From the drop-down list select the event determined on the Custom Metadata > Events tab in repository parameters settings.
After task execution a specified custom event is generated. This event will be handled by the tasks with configured execution after custom event.
Additional parameters of result handling are available for the Regular Report Calculation task:
Task execution result can be published to the SharePoint web site. To do this:
Select the Publish to SharePoint checkbox.
In the input box enter web site address, for example: http://v-ps-sharepoint.
After task execution the report calculation result will be published on the specified site.
NOTE. User credentials specified at the OS login are used by default for authentication in the SharePoint site. If it is required to log in as a different user, describe the <SPCredentials> section in the configuration file.
Task calculation result can be published to FTP server. To do this:
Select the Publish to FTP Server checkbox.
Set server address in the input field.
After task execution the report calculation result is published to the specified server.
IMPORTANT. On setting up saving files to FTP server, the configuration file must contain description of the <FTP> section, otherwise the report file is not saved to server.
To print task execution result:
Select the Print checkbox.
Specify a printer in the following format: <Server>\<Printer>.
File format and export options can be specified for a report attached to a message and/or published to SharePoint web site or FTP server:
Select report format in the File Format drop-down list:
PPREPORT File (*.ppreport).
EMF File (*.emf).
OpenDocument Spreadsheet (*.ods)
Web Page, single file archive (*.htm).
RTF Document (*.rtf).
PDF Document (*.pdf).
Excel Workbook 97-2003 (*.xls).
Excel Workbook (*.xlsx).
To set up report export options, click the Options button. The Export Options dialog box opens. The dialog box view depends on the selected report export format.
After task execution the report calculation result is exported to the specified format.
See also: