Email notification for BPM user tasks

Hi,

I want to ask you about some ideas about email notifications in BPM process. I want to send email for user task assignees but I want to add task link to content.
I tried to use BPM Email task, but there is problem with task ID. I need to send email before task is assigned to users/user group, but in that time, task is still not created.
Then I found that notification ann-on can be used and its really easy to use it. Get task informations to email body is perfect in this solution, but when I use it in BPM add-on on user task, notification is send after User task is done, not before. So I get everything, but I send notification with link in time, that they already finished task.

Is there any good way to prepare and send this type of email in BPM add-on or any configuration for notification add-on to send email when task is created, not after completing?

Thank you
Pavel

You can use UserTaskAssignedEvent. Event Listeners :: Jmix Documentation
The data about the task is available there.

It will not work in the process model via the Email Sending Task.

2 Likes

Hi,

thanks for nice solution. I just want to ask on one more thing about that event data. When I use method event.getTask().getProcessVariables(), I get null value. Its taking process variables, but not from whole WF, but just in task itself. Is there any way to get those variables but for whole process? In event.getProcessDefinition(), there is not method to get those variables, its just definition, but not process instance right?

Thanks

Of course, there is such a possibility.
Use RuntimeService()#getVariable(executionId, variableName) or bprocRuntimeService.getVariable(executionId, variableName).

You can get the executionId via event.getTaskData().getExecutionId().