03-23-2020 10:55 AM
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?
03-25-2020 09:46 AM
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); }
03-23-2020 11:37 AM
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.
03-23-2020 04:27 PM
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?
03-25-2020 04:27 AM
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
03-25-2020 09:46 AM
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); }
Explore our Alfresco products with the links below. Use labels to filter content by product module.