cancel
Showing results for 
Search instead for 
Did you mean: 

How to send an email to a candidate group on Activiti 6

matteo_zanardo
Champ on-the-rise
Champ on-the-rise

Good morning, I want to know how to send an email to notify all members of a group that I created.
Thanks in advance for the answer.

8 REPLIES 8

mdtabrezmca
Star Contributor
Star Contributor

Hi,

    As per my understanding

    If you want to send the notification using "User Task" then whoever you have assigned in the "Assignement" field of that task will be notified by email when the task is created.(In this case if you select "Assignement" as a group, an email notification to all the users in that group can be sent).You can check the documentation about the "User Task" and assignment here Activiti User Guide 

   If you want to send the separate email notification using "Email Task" then you can create a comman seperated list and assign to "To" field in the email task. for more detials about email task you can check the activiti documentation Activiti User Guide

Hi, I would like to send it as Mail task.
In the "To: " field instead of writing the various mail addresses, I wanted to know if there was a way to indicate the name of the group and make the system send the mail to the email addresses of the various users in the group automatically.

I do not know I am explained well

I See what you are looking for but i cant find any thing relevent Funcationality which you can use to send the mail to a group directly.One thing i would suggest you to use Execution listener to do this job. You can check some of the test cases written for mail task here Activiti/modules/activiti-engine/src/test/resources/org/activiti/engine/test/bpmn/mail at 6.x · Acti... 

Which is clearly suggesting to use comma seperated value for this..........

the way i worked it out-

use email task

make it multi instance (parallel)

mention this in the collection - ${identityService.createUserQuery().memberOfGroup("your_group_name").list()}

element variable - user

To: ${user.getEmail()}

you can use user object in body as well to get the name.

this way you can send individual emails to everyone in the mentioned group.

abbask01
Star Collaborator
Star Collaborator

A quicker way would be to calculate the email addresses beforehand, then passing it as comma-separated string in the To attribute. Using the mail task synchronously, It would significantly reduce the time it takes to move from mail task to the next task in process, if the number of recipients are large.

Regards,
Abbas

prohit
Champ on-the-rise
Champ on-the-rise

Hi Sir,

I have little similar requirement request you to kindly advise.

1. In usertask i have created "Process_End_Date" field in form for process end date, now i have to send notification to the user 6 hours prior due date of "Process_End_Date", we know that we can define due date but how to send notificatoin based on this field, since there is no option to use this variable in timer field nor boundary field to trigger notification. 

2. When i am selecting date and using this variable in email task to mail recipient to mention due date, the date format is  coming as "2021-03-19T00:00:00.000Z", i have tried to change the format in "Process_End_Date" with different verisions but i am unable to neither update T00:00:00.000Z nor eliminate this in email. Kindly help me with this two questions, really apprecaite your help in advance.

Regards,

PR

saif
Champ on-the-rise
Champ on-the-rise

Hi prohit,

have you found any solution for point two(2),

Best regards.

abbask01
Star Collaborator
Star Collaborator

APS's email templates are made from freemarker templates. If you're using a custom template (ftl) you can use freemarker's date functions to change format. See https://freemarker.apache.org/docs/ref_builtins_date.html

If you want just the date from timestamp you can do


${PROCESS_VAR?date}
Regards,
Abbas