Notify always whenever a new task is assigned

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Established Member II

Notify always whenever a new task is assigned

Jump to solution

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?

 

1 Solution

Accepted Solutions
Highlighted
Established Member II

Re: Notify always whenever a new task is assigned

Jump 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);
}

 

View solution in original post

4 Replies
Highlighted
Active Member II

Re: Notify always whenever a new task is assigned

Jump to solution

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.

Highlighted
Established Member II

Re: Notify always whenever a new task is assigned

Jump to solution

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?

Highlighted
Active Member II

Re: Notify always whenever a new task is assigned

Jump to solution

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

 

Highlighted
Established Member II

Re: Notify always whenever a new task is assigned

Jump 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);
}

 

View solution in original post