# Create a list of checkboxes - 6.4.2

**URL:** <https://community.ofelia.com/t/create-a-list-of-checkboxes-6-4-2/5787>\
**Category:** Q&A\
**Created:** [25 March 2015 13:38 UTC](https://community.ofelia.com/t/create-a-list-of-checkboxes-6-4-2/5787 "2015-03-25T13:38:17Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![chiaraparpinello](https://avatars.discourse-cdn.com/v4/letter/c/f6c823/32.png) [@chiaraparpinello](https://community.ofelia.com/u/chiaraparpinello)\
**Post date:** [25 March 2015 13:38 UTC](https://community.ofelia.com/t/create-a-list-of-checkboxes-6-4-2/5787/1 "2015-03-25T13:38:17Z")

</div>

Hi.  
Is there a way to create a list of users with their own checkbox associated ?  
Many thanks, bye.

Chiara.

---

<div class="post-metadata">

**Author:** ![yannick.lombardi](https://avatars.discourse-cdn.com/v4/letter/y/8e8cbc/32.png) [@yannick.lombardi](https://community.ofelia.com/u/yannick.lombardi)\
**Post date:** [25 March 2015 14:55 UTC](https://community.ofelia.com/t/create-a-list-of-checkboxes-6-4-2/5787/2 "2015-03-25T14:55:13Z")

</div>

Hi.  
You need to add a “CheckBox list” widget in your form.  
In the “Data” tab of this widget, you need to add the user list in the “available value” field.  
To have the list of users, you can use this script :  
  
import org.bonitasoft.engine.identity.User;  
import org.bonitasoft.engine.identity.UserCriterion;

int nbUser = apiAccessor.getIdentityAPI().getNumberOfUsers();

List userList = apiAccessor.getIdentityAPI().getUsers(0, nbUser, UserCriterion.USER\_NAME\_ASC);

List userNameList = new ArrayList();

for (User user : userList) {  
userNameList.add(user.getUserName());  
}

return userNameList;

---

<div class="post-metadata">

**Author:** ![chiaraparpinello](https://avatars.discourse-cdn.com/v4/letter/c/f6c823/32.png) [@chiaraparpinello](https://community.ofelia.com/u/chiaraparpinello)\
**Post date:** [25 March 2015 16:16 UTC](https://community.ofelia.com/t/create-a-list-of-checkboxes-6-4-2/5787/3 "2015-03-25T16:16:30Z")

</div>

Thank you ! Now I can see the users list !

Can I ask you one more thing ?

How can I save the “check” value to send it to another form ?

These are my first steps with Bonita, and I’m trying to learn.

Thanks again.  
Chiara

---

<div class="post-metadata">

**Author:** ![yannick.lombardi](https://avatars.discourse-cdn.com/v4/letter/y/8e8cbc/32.png) [@yannick.lombardi](https://community.ofelia.com/u/yannick.lombardi)\
**Post date:** [25 March 2015 16:31 UTC](https://community.ofelia.com/t/create-a-list-of-checkboxes-6-4-2/5787/4 "2015-03-25T16:31:27Z")

</div>

You need to create a List variable in your Process. (I will name it selectedUserList)  
Then in the form, go in the “Data” tab of the “CheckBox list” widget.  
You can see something like :  
“Output Operation [anEmptyField] Takes value of [anEmptyField]”  
In the first field, select the selectedUserList variable that you just create. And in the second field, choose your field\_checkboxlist.

Like this, the selectedUserList variable contains all the names that are checked in the form. And you can use this list in every other task of your process.

---

<div class="post-metadata">

**Author:** ![chiaraparpinello](https://avatars.discourse-cdn.com/v4/letter/c/f6c823/32.png) [@chiaraparpinello](https://community.ofelia.com/u/chiaraparpinello)\
**Post date:** [26 March 2015 09:03 UTC](https://community.ofelia.com/t/create-a-list-of-checkboxes-6-4-2/5787/5 "2015-03-26T09:03:14Z")

</div>

Thanks a lot for your help!

---

<div class="post-metadata">

**Author:** ![chiaraparpinello](https://avatars.discourse-cdn.com/v4/letter/c/f6c823/32.png) [@chiaraparpinello](https://community.ofelia.com/u/chiaraparpinello)\
**Post date:** [27 March 2015 10:23 UTC](https://community.ofelia.com/t/create-a-list-of-checkboxes-6-4-2/5787/6 "2015-03-27T10:23:11Z")

</div>

Sorry again if I ask you one more question. Is there a way to make “Actor” of the task the user who checked in the checkbox?

Thanks!

---

<div class="post-metadata">

**Author:** ![chiaraparpinello](https://avatars.discourse-cdn.com/v4/letter/c/f6c823/32.png) [@chiaraparpinello](https://community.ofelia.com/u/chiaraparpinello)\
**Post date:** [30 March 2015 09:52 UTC](https://community.ofelia.com/t/create-a-list-of-checkboxes-6-4-2/5787/7 "2015-03-30T09:52:17Z")

</div>

Sorry to bother you, where do you put this script ?  
In the " Task 1 " I have a list of checkboxes and I would that the actor of the Task2 was the one previously selected in the Task1.  
If I put this script on the " Task2 - Action filtrer" this gave me an error.  
Where am I wrong?

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![yannick.lombardi](https://avatars.discourse-cdn.com/v4/letter/y/8e8cbc/32.png) [@yannick.lombardi](https://community.ofelia.com/u/yannick.lombardi)\
**Post date:** [30 March 2015 09:59 UTC](https://community.ofelia.com/t/create-a-list-of-checkboxes-6-4-2/5787/8 "2015-03-30T09:59:48Z")

</div>

EDIT : I copy the wrong script. See the answer below for the good script.

---

<div class="post-metadata">

**Author:** ![yannick.lombardi](https://avatars.discourse-cdn.com/v4/letter/y/8e8cbc/32.png) [@yannick.lombardi](https://community.ofelia.com/u/yannick.lombardi)\
**Post date:** [30 March 2015 10:03 UTC](https://community.ofelia.com/t/create-a-list-of-checkboxes-6-4-2/5787/9 "2015-03-30T10:03:29Z")

</div>

I copy the wrong script in my last answer.  
To assign a task to a user, you need to put this in the “Actor Filter” :  
  
Long idUser;  
try {  
idUser = apiAccessor.getIdentityAPI().getUserByUserName(userName).getId();  
} catch (Exception e) {  
}  
return idUser;

If the selected user doesn’t exist, the api will send an Exception and you can assign the task to another user in the “catch”.
