Hello
Is it possible to send a notification email to a user always whenever there is a new task assigned to him (no matter what task)?
Right now, I have to create TaskListeners in every single process, in every single task. Is there a better way to do it?
Solved! Go to Solution.
Unfortunately, in the community version, we do not have activity-app.
If you want to implement it using TaskListeners:
1. In your task properties add new TaskListener as Java class on event "complete".
2. Create a Java class and inside the execute function (don't forget about implements TaskListener ) call function similar to this one: (getServiceRegistry() is my custom function taken from ActivitiScriptBase.java)
public void sendEmail(String recipient, String taskId) { String message_body = "<p>My HTML message <b>"; ActionService actionService = getServiceRegistry().getActionService(); Action mailAction = actionService.createAction(MailActionExecuter.NAME); mailAction.setParameterValue(MailActionExecuter.PARAM_SUBJECT, Notification.SUBJECT); mailAction.setParameterValue(MailActionExecuter.PARAM_TO, recipient); mailAction.setParameterValue(MailActionExecuter.PARAM_FROM, Notification.FROM_ADDRESS); mailAction.setParameterValue(MailActionExecuter.PARAM_HTML, message_body); actionService.executeAction(mailAction, null); }
In User tasks there is the "Allow Email notifications" checkbox that you can use, and define the content of the email with the "Email template" field. When the task is re-assigned to other user I think the only option is a Task listener. If you find another simpler approach, please share it. Thanks.
That is exactly what am I looking for! Could you please share more information on how to find this option?
After a quick research, I understand that it is not an option in the Alfresco Share but within some Process Designer (App Designer?). Is this app avaiable from Community version?
I'm using APS and this is an option of the BPMN editor in activiti-app. If you have put a "User task" in the canvas, in the properties pane you will find the option to send the email. The Email templates are in the: Identity Management -> Tenants -> Email template.
I haven't worked with the Community Edition, so I'm not sure whether this is available there too; sorry.
Would you explain how are you implemented this using listeners? Yesterday I was trying this approach woth no success.
Best,
Jose
Unfortunately, in the community version, we do not have activity-app.
If you want to implement it using TaskListeners:
1. In your task properties add new TaskListener as Java class on event "complete".
2. Create a Java class and inside the execute function (don't forget about implements TaskListener ) call function similar to this one: (getServiceRegistry() is my custom function taken from ActivitiScriptBase.java)
public void sendEmail(String recipient, String taskId) { String message_body = "<p>My HTML message <b>"; ActionService actionService = getServiceRegistry().getActionService(); Action mailAction = actionService.createAction(MailActionExecuter.NAME); mailAction.setParameterValue(MailActionExecuter.PARAM_SUBJECT, Notification.SUBJECT); mailAction.setParameterValue(MailActionExecuter.PARAM_TO, recipient); mailAction.setParameterValue(MailActionExecuter.PARAM_FROM, Notification.FROM_ADDRESS); mailAction.setParameterValue(MailActionExecuter.PARAM_HTML, message_body); actionService.executeAction(mailAction, null); }
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.