cancel
Showing results for 
Search instead for 
Did you mean: 

Assigning task to bunch of users using activiti API

shivnarayanvarm
Champ in-the-making
Champ in-the-making
Dear Developers,

Can you please help with sample code to assign a task to multiple users ( not a single user).

List<String> userList = findUserService.findUsersByTaskLevel(execution,"approveAction");
        for (String userId : userList){
           taskService.addCandidateUser(execution.getId(), userId);
        }

Is this the right way, but this is not working for me.

1 REPLY 1

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

 
  /**
   * Convenience shorthand for {@link #addUserIdentityLink(String, String, String)}; with type {@link IdentityLinkType#CANDIDATE}
   * @param taskId id of the task, cannot be null.
   * @param userId id of the user to use as candidate, cannot be null.
   * @throws ActivitiObjectNotFoundException when the task or user doesn't exist.
   */
  void addCandidateUser(String taskId, String userId);

use taskId instead of executionId.
Candidate users are not the same as the assignee.

Regards
Martin