Setting Up Handling of Task Execution Result

In this article:

Notify by Email

Example of Unit

Calling Event

Additional Parameters of Result Handling for Regular Report

Publish to SharePoint

Publish to FTP server

Print

File Format and Export Options

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:

To create a new task

To open ready task

The following result handling options are available for all tasks:

The following additional result handling options are available for regular report calculation task:

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.

Notify by Email

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:

NOTE. The list shows only functions with the signature: Function <name>(<param>: IScheduledTask): IArrayList.

IMPORTANT. On setting up email sending the configuration file must contain description of the <HOST> section, otherwise emails will not be sent.

Example of Unit

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.

Calling Event

To set up custom event execution after the task calculation, follow the steps:

  1. Select the Call Event checkbox.

  2. 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 for Regular Report

Additional parameters of result handling are available for the Regular Report Calculation task:

Publish to SharePoint

Task execution result can be published to the SharePoint web site. To do this:

  1. Select the Publish to SharePoint checkbox.

  2. In the input box enter web site address, for example: http://v-ps-sharepoint.

  3. Set file format and export options.

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.

Publish to FTP server

Task calculation result can be published to FTP server. To do this:

  1. Select the Publish to FTP Server checkbox.

  2. Set server address in the input field.

  3. Set file format and export options.

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.

Print

To print task execution result:

  1. Select the Print checkbox.

  2. Specify a printer in the following format: <Server>\<Printer>.

File Format and Export Options

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:

  1. Select report format in the File Format drop-down list:

  1. 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:

Creating Scheduled Tasks