Advanced Techniques - Summary emails

1. General

This workshop will demonstrate how to create a summary email instead of sending multiple individual emails so that every employee receives a daily email with a summary of their uncompleted tasks, for example. A modified application and a process are required for this. You can find a ZIP file with our example here. You can import this into your portal as usual.

2. Modify the application

2.1. Reference to users




In the data records, which should be summarized in a summary email, a reference to the User Manager is created via the properties dialog of the data group. This provides the UserID, Username and Business email fields.

2.2. Modify the edit page

On the edit page, the user can be selected from a drop-down-list that has been configured accordingly.

2.3 Data field for email send date




Now we need a data field - in our example the data field "Sent on" with the datetime data type. This field will not be linked to an edit element. It will only be populated with values by the process.

2.4 Create the view page




A view page (such as the "tbl_Details" page in our example) is required to display the required data from a single data record (a task in this case). This page can be provided with a button which the users can use later to open the task from the summary email.

2.5 Create a free layout table




A page is required for the summary email that filters the data accordingly and then lists this data in the email. In our example, we add a free layout table to a view page ("Summary email" in this case) on the top level of the application structure. The view page tbl_Details is integrated in the properties dialog of the table.

2.6. Filters




In our example, the second condition excludes all tasks that haven't been completed (Completed = false). This status is recorded using the checkbox on the edit page. The first condition is important (Ref. user - User ID = 'int_BenutzerId'). The user ID saved in the data record is compared to the variable "int_BenutzerId" from the corresponding process. In the filter, the "System value" option is selected with the setting "Processing context" so that the table filter can process the values of the variables. The variable name (int_BenutzerId) is entered as the value. The table filter cannot be constructed in the normal fashion as the table is not intended for a page in the browser but for a page that will be embedded in an email of any standard email program.

3. Process

3.1. Global timer




The first element in the process is a global timer that triggers the process once per day. The required application and data group - Tasks in this case - have been selected on the Data group tab in the properties dialog. The data group is also filtered like the table in the application, meaning only tasks that haven't been completed will be checked. Furthermore, the date data field (Sent on) that was created for this purpose in the application must be empty. The filter expression needs to be created with an OR connection. The first condition is that this field does not contain a value (Sent on is undefined). The second part filters the tasks so that every uncompleted task that was sent before 00:00 today will be added again to the summary email.

3.2. Timer event handler




The second element in the process is a timer event handler that responds to the global timer.

3.3. Groovy script action




A Groovy script action (Compile recipients) is connected to the timer event handler as the third element in the process. This contains the following script:
def int_BenutzerId = g_record["29EAEF57FB774606A0F0E81FEAACCE669E6E9345"].value /* datafield Ref. Benutzer - (REF-PK) Benutzer ID <integer> */
g_sharedState.int_BenutzerId = int_BenutzerId
The variable int_BenutzerId is defined here and the UserID saved in the current data record is read. The variable is made available in the processing context with g_sharedState.

3.4. Filter condition




This checks whether the user, who was determined in the previous Grovvy script action, has already received a summart email. The date data field (Sent on) may not contain data. The filter expression needs to be created with an OR connection. The second part defines that every uncompleted task that was sent before 00:00 today will be added again to the summary email.

3.5. Email action




The view page from the application is integrated into this action. Intrexx uses the variable int_BenutzerId, which was creates in the Groovy Script action, in this step to filter the table on the integrated page. The table filter is applied automatically before the email is sent and filters the tasks in the table accordingly.



The recipient is determined from the referenced business email address.

3.6. Data group action




The last element in the process chain is a data group action. So that an email isn't sent to the responsible employee for every data record, all of their other tasks are provided with todays date, 00:00.



The following settings are applied on the Manipulation quantity tab:

Simple filter

The source and target data group are the same, "Tasks" in our example. The data field, the referenced user (Ref. User - Ref-PK) in our example, is also the same.

Field assignment




A user-defined value is created in the field assignement. This provides todays date, 00:00. The value is then assigned to the data field (Sent on). The process is now completed.

The Email service must have been configured to send emails.