# Candidate group deleted from task after its assigned to the user

**URL:** <https://forum.flowable.org/t/candidate-group-deleted-from-task-after-its-assigned-to-the-user/6427>\
**Category:** Uncategorized\
**Created:** [July 23, 2020, 10:44am UTC](https://forum.flowable.org/t/candidate-group-deleted-from-task-after-its-assigned-to-the-user/6427 "2020-07-23T10:44:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bijeshcnair](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/bijeshcnair/32/1452_2.png) [@bijeshcnair](https://forum.flowable.org/u/bijeshcnair)\
**Post date:** [July 23, 2020, 10:44am UTC](https://forum.flowable.org/t/candidate-group-deleted-from-task-after-its-assigned-to-the-user/6427/1 "2020-07-23T10:44:45Z")

</div>

HI ,  
I added two candidate groups to a task.  
Then I assigned the task to a user.  
Now there are not tasks for the candidate group.

```
    Task task = taskService.newTask();
    task.setName("assignee task 2");
    taskService.saveTask(task);

    taskService.addCandidateGroup(task.getId(),"group-1");
    taskService.addCandidateGroup(task.getId(),"group-2");
    assertThat(taskService.createTaskQuery().taskCandidateGroup("group-1").list().size()).isEqualTo(1);

    taskService.setAssignee(task.getId(),"user-1");
    assertThat(taskService.createTaskQuery().taskCandidateGroup("group-1").list().size()).isEqualTo(1);//Fails

```

The second assertion fails.  
Is this the way its supposed to work (As once the task is assigned to a user, then it should be removed from the candidate group\_ ?

---

<div class="post-metadata">

**Author:** ![joram](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/joram/32/26_2.png) [@joram](https://forum.flowable.org/u/joram)\
**Post date:** [July 30, 2020, 4:59pm UTC](https://forum.flowable.org/t/candidate-group-deleted-from-task-after-its-assigned-to-the-user/6427/2 "2020-07-30T16:59:33Z")

</div>

> [@bijeshcnair](#):
>
> Is this the way its supposed to work (As once the task is assigned to a user, then it should be removed from the candidate group\_ ?

Yes. Once a task is assigned, the task is not a candidate anymore for anyone else.
