cancel
Showing results for 
Search instead for 
Did you mean: 

Convert Group of People to a Collection

bigs4321
Champ in-the-making
Champ in-the-making

I am building out a workflow where the user can select multiple groups of people for a later Mail Task process.  I need to convert the Group of People to a collection of email addresses and preferably via a Script Task listener in either javascript or groovy.

Does anyone have any pointers on how to do this?

Thanks,

Colin.

2 REPLIES 2

bigs4321
Champ in-the-making
Champ in-the-making

So I see I should use a REST call to the APS REST services, like

activiti-app/api/enterprise/groups/<group id>/users

And this will give me the list of users.  In the Response Mapping I can do things like data[0].email and place into a variable.  Is there a way to pull all data[X].email into a variable/array or can this be done via a Groovy script?

Thanks.

abbask01
Star Collaborator
Star Collaborator

You can also try (from a spring bean) groupService.getFunctionalGroup(groupId).getUsers().stream().map(user -> user.getEmail()).collect(Collectors.toList())

Regards,
Abbas