A customer of mine had the requirement to send an email every time a task is created for a user. Rather than polluting our process with an email activity we decided to use the built in functionality IBM BPM provides. When a user logs in into Process Portal she/he can set some preferences. One of them is to send an email when a new task arrives for the user (or his group).

We had two small challenges when implementing this behavior.
1st The first challenge we encountered was the following: The customer stores the email addresses in its LDAP directory. The users and there corresponding email addresses our synchronized with the WebSphere User Registry. The users from the WebSphere User Registry are also synchronized with the BPM User registry. So far so good, the problem is that although users are synchronized to BPM the email addresses are not.
In order to solve this we wrote a synchronization script in Process Designer which queries the LDAP and updates the BPM user registry. With this script we can also enable the notification.

IBM BPM Task Notification Email template 1

2nd The next challenge was the format of email. IBM uses a template to create this mail. As expected this template can be customized. We started with the default template from IBM. It can be found by unpacking \BPM\Lombardi\process-server\lib\procsrv_resources.jar. In this jar you find a template for every language. You have 2 flavors extermailprocess_{0}.html and extermailnoprocess_{0}.html. The difference between the two is that the first one is used for tasks that are part of a BPD and the second one for tasks that are not a part of a BPD.

You should not edit this templates directly in the file. You should copy them and make changes on the copied files. After you have your own templates create a jar file from them and place this jar file in a shared library on your process server.

Now you need to tell IBM BPM to use your templates instead of the default ones. To do this place the following fragment in your 100Custom.xml file:

IBM BPM Task Notification Email template 2

Of course you should customize this to match your own environment. The {0} part of the process/noprocess template is replaced with the user locale. For more information on the different setting you can look into the information center.

Author: Jef