Convert Group of People to a Collection

cancel
Showing results for 
Search instead for 
Did you mean: 
bigs4321
Partner

Convert Group of People to a Collection

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
bigs4321
Partner

Re: Convert Group of People to a Collection

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
Senior Member

Re: Convert Group of People to a Collection

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

Regards,
Abbas