Tips & Tricks - Roundup Email
In this post, you'll learn how to create a consolidated email instead of sending several individual emails, so that, for example, each employee receives a daily email listing all their pending tasks. This requires a customized application and a process that starts automatically once a day. Here you'll find a ZIP file containing our example, which you can import into a portal as usual.
Customize the Application
Reference to a user
In the data records that are to be consolidated into a bulk email, a reference to the "Users" module is created via the data group's Properties dialog. This provides the user ID, username, and work email address.
Customize the input page
On the input page, the user can be selected from a properly configured drop-down list.
Data field for the date the email was sent
Now one more data field is needed—in this example, the "Sent on" data field with the "Datetime" data type. This field is not linked to an input element. It is filled with values exclusively by the process.
Create a View Page
Next, a view page (in this case, for example, the "tbl_Details" page) is created to display the desired data for a single record (in this case, a task). This page can include a button that allows a user to open the task later from the summary email.
Create a Custom Table
For the summary email, a page is needed that lists the appropriately filtered data in the email. In this example, we implement this using a custom table on a view page (in this case, the "Bulk Email" page on the first level of the application structure ). The "tbl_Details" view page is included in the table's properties dialog.
Filter
In this example, the second condition excludes all uncompleted tasks (Completed = False). This status is selected using the checkbox on the input page. The first condition is interesting (Ref. Users - User ID = 'int_UserId'). Here, the user ID stored in the dataset is compared to the "int_UserId" variable to check if they match. The variable comes from the associated process. Here in the filter, the "System" option is set to "Processing Context" so that the table filter can process the values of the variables. The variable name (int_UserId) is entered as the value. The table filter cannot be set up in the usual way here, because the table is not being created for a page in a browser, but for a page that will be embedded in an email sent from any standard email program.
Process
After the import, the process is initially disabled. If you want to run and test the example, activate the process.
Global Timer
The first element in the process is a global timer that starts the process chain once a day. In the Properties dialog box, select the desired application and data group—in this case, Tasks—on the Data Groups tab. The data set—like the table in the application—is filtered so that only uncompleted tasks in the process are examined. In addition, the "Sent on" date field—which was created specifically for this purpose in the application—must not be filled in. The filter expression must be created here using an OR operator. The first condition is that the field contains no value ("Sent on" is undefined). The second part filters the tasks so that all uncompleted tasks sent before midnight today are included in the summary email again.
Timer Event Handler
The second element in the process is a timer event handler that responds to the global timer.
Groovy Event
Using the timer event handler, the Groovy action "Compile Recipients" is linked to the process as the third element, using the following script:
def int_UserId = g_record["29EAEF57FB774606A0F0E81FEAACCE669E6E9345"].value /* datafield Ref. Users - (REF-PK) User ID <integer> */
g_sharedState.int_UserId = int_UserId
Here, the variable "int_UserId" is defined, and the user ID stored in the current date record is retrieved. The variable is made available in the processing context as `g_sharedState`.
Filter Condition
Checks whether the user identified by the preceding Groovy action has already received a bulk email. The "Sent on" date field must be left blank. The filter expression is created using an OR operator. The second condition specifies that all uncompleted tasks sent before midnight today must be included in the summary email.
Email Campaign
In the email campaign, the view page is embedded from the application. In this process step, Intrexx uses the variable "int_UserId" created in the Groovy action to filter the table on the embedded page. The table filter created in the application is automatically applied before the page is sent and filters the tasks in the table accordingly.
The recipient is identified based on the business email address provided.
Data Group Action
The final element in the process chain is a data group action. To prevent an email from being sent to the responsible employee for every data record, all of the employee's other tasks are assigned today's date and time (12:00 a.m.) at this point.
On the "Manipulation Quantity" tab, the following settings are configured:
Simple Filter
The destination and source data groups are the same data group—in this example, the "Tasks" data group. The data field—in this example, the referenced user (Ref. User - (Ref-PK) User ID) is the same for both the destination and the source.
Field Mapping
In the field mapping, a user-defined value is created that returns today's date at 12:00 a.m. The value is then assigned to the "Sent on" data field. The process is now complete.
To send emails, the email service must be configured in Intrexx.














