cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti6: Send email to the assigned user in a flow

chrisx_212
Champ in-the-making
Champ in-the-making
Hello. I would like to ask about a feature in Activiti6.

I want to create a feature where an email is sent to a user when they are assigned with a Task (or if they become candidates to do a Task). I have the codes to send the email ready, but I don't know where to put the code. Where do you think I should put the code?

Thanks
7 REPLIES 7

chrisx_212
Champ in-the-making
Champ in-the-making
Addition: The task assigning usually occur after they fill up a form for the task.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Chris.

Have a look on org.activiti.examples.bpmn.tasklistener.TaskListenerTest#testTaskCreateListenerin activiti source.

Regards
Martin

chrisx_212
Champ in-the-making
Champ in-the-making
I ran to another problem here. I know the location, but in Activiti 6, the users are stored in the 'users' table, not 'act_id_user'. For instance, in 'users', there is the Administrator's data with ID '1'. However, if I use the (org.activiti.engine.identity.)User object to get the data for the email, it will refer to 'act_id_user', in which there is no data with ID '1'.

I would like to get the user data from the 'Users' table. How do I do it?

jbarrez
Star Contributor
Star Contributor
Then you'd need to use the Userservice bean that is in the v6 service layer.

chrisx_212
Champ in-the-making
Champ in-the-making
How do I use that within the Activiti Engine module? I tried using it there, and it gives out an error, they won't even read the import.

For the record, this is what I tried to import: com.activiti.service.api.UserService and com.activiti.domain.idm.User

Within the activiti-engine modules like org.activiti.engine.impl.history.handler

chrisx_212
Champ in-the-making
Champ in-the-making
Sorry for double post but can anyone answer this question about how to call out User Service within an Engine Module?

jbarrez
Star Contributor
Star Contributor
I'm assuming by 'com.activiti.domain.idm.User' you are using enterprise (there is another forum for that specifically).
To get the UserServicr there, you inject it with @Inject or @AutoWire and make your listener a Spring bean too.