12-28-2016 03:24 PM
How can I set a list users (e.g. in a comma delimited string) as candidate assignees? I am passing the list to the start form with the process-instance API and attempting to use an expression in the candidate property on the user task.
01-03-2017 03:02 PM
For Enterprise Edition, I use the following script task (groovy) code snippet in BP3's Activiti Basic training to demonstrate this exact scenario.
The example uses the userService to get all users and iterate over the result, but you can use the same technique on a comma separated list passed into the process:
import com.activiti.domain.idm.User;
import com.activiti.security.SecurityUtils;out.println('Start - Init');
User currentUser = SecurityUtils.getCurrentUserObject();
ArrayList idList = new ArrayList();
Long tenantId = currentUser.getTenantId();List<User> users = userService.getAllUsers(0,999,tenantId);
for (User u : users) {
idList.add(String.valueOf(u.getId()));
}execution.setVariable('assigneeList', idList);
out.println('End - Init');
Once you have a list of user ids assigned to a process instance variable, simply set the candidate users to reference the list:
If you are using Community Edition, the approach is exactly the same but instead of using userService you would use identityService.
Hope this helps,
Greg
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.