# Task assigngment queries

**URL:** <https://forum.camunda.io/t/task-assigngment-queries/37031>\
**Category:** Discussion & Questions\
**Created:** [April 19, 2022, 7:25am UTC](https://forum.camunda.io/t/task-assigngment-queries/37031 "2022-04-19T07:25:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rohit\_Singh](https://forum.camunda.io/user_avatar/forum.camunda.io/rohit_singh/32/12172_2.png) [@Rohit\_Singh](https://forum.camunda.io/u/Rohit_Singh)\
**Post date:** [April 19, 2022, 7:25am UTC](https://forum.camunda.io/t/task-assigngment-queries/37031/1 "2022-04-19T07:25:40Z")

</div>

I have couple of questions regarding task assignment. In our workflow, there can be task which should be assigned to:

1. All users in system
2. All users except an user who trigerred the workflow ($createdBy is the variable in workflow).

How can I set the assignee field for above 2 use cases?

**Output:**  
In case 1: any one who logs in should see the task assigned to him.  
In case 2: any one except $createdBy should see the task when he logs in.

when user logs in, we are getting the task assigned to user by rest api call. (/task?assignee=user-1)

---

<div class="post-metadata">

**Author:** ![aravindhrs](https://forum.camunda.io/user_avatar/forum.camunda.io/aravindhrs/32/32503_2.png) [@aravindhrs](https://forum.camunda.io/u/aravindhrs)\
**Post date:** [April 19, 2022, 9:25am UTC](https://forum.camunda.io/t/task-assigngment-queries/37031/2 "2022-04-19T09:25:25Z")

</div>

> [@Rohit\_Singh](#):
>
> In case 1: any one who logs in should see the task assigned to him.

By setting `camunda:candidateUsers` attribute will allow the users to access the tasks which they are authorised to work.

```auto
<bpmn:userTask id="Activity_155cewx" camunda:candidateUsers="${candidateUserList}">
   <bpmn:incoming>Flow_18f4ni2</bpmn:incoming>
</bpmn:userTask>

```

> [@Rohit\_Singh](#):
>
> In case 2: any one except $createdBy should see the task when he logs in.

Follow the above same approach and additionally, add the task listener to the user task to exclude the created user if all the users belong to the same group.

---

<div class="post-metadata">

**Author:** ![Rohit\_Singh](https://forum.camunda.io/user_avatar/forum.camunda.io/rohit_singh/32/12172_2.png) [@Rohit\_Singh](https://forum.camunda.io/u/Rohit_Singh)\
**Post date:** [April 19, 2022, 9:36am UTC](https://forum.camunda.io/t/task-assigngment-queries/37031/4 "2022-04-19T09:36:58Z")

</div>

for case 1:  
what is `candidateUserList` ? We have about 1 million users in our system. Do we pass all the id’s as array in the list?

Any suggestions?

---

<div class="post-metadata">

**Author:** ![aravindhrs](https://forum.camunda.io/user_avatar/forum.camunda.io/aravindhrs/32/32503_2.png) [@aravindhrs](https://forum.camunda.io/u/aravindhrs)\
**Post date:** [April 19, 2022, 11:43am UTC](https://forum.camunda.io/t/task-assigngment-queries/37031/5 "2022-04-19T11:43:00Z")

</div>

@Rohit_Singh if the users are many, then you can use `candidateGroups`

---

<div class="post-metadata">

**Author:** ![Rohit\_Singh](https://forum.camunda.io/user_avatar/forum.camunda.io/rohit_singh/32/12172_2.png) [@Rohit\_Singh](https://forum.camunda.io/u/Rohit_Singh)\
**Post date:** [April 19, 2022, 12:03pm UTC](https://forum.camunda.io/t/task-assigngment-queries/37031/6 "2022-04-19T12:03:14Z")

</div>

Hi @aravindhrs But that would require me to add all users in a group, right?

Also, we don’t maintain users in camunda database. In camunda, we just pass id’s. For example if we need to assign a task to group-1 we just set assignee=group-1 in camunda. In our system, if someone logs in from group-1 we call camunda’s rest-api with /task?assignee=group-1 and get the task. Do you see a problem with the approach?

---

<div class="post-metadata">

**Author:** ![system](https://forum.camunda.io/uploads/default/original/3X/5/8/58d50142eacca605d35cb1ef9e6b86ae85f49436.png) [@system](https://forum.camunda.io/u/system)\
**Post date:** [January 31, 2024, 10:13am UTC](https://forum.camunda.io/t/task-assigngment-queries/37031/7 "2024-01-31T10:13:02Z")

</div>

Closed on January 31, 2024, 10:13am UTC


