# Single user Actor Filter

**URL:** <https://community.ofelia.com/t/single-user-actor-filter/8400>\
**Category:** Q&A\
**Created:** [20 April 2017 07:40 UTC](https://community.ofelia.com/t/single-user-actor-filter/8400 "2017-04-20T07:40:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![claudio.taragnolini](https://avatars.discourse-cdn.com/v4/letter/c/b9e5f3/32.png) [@claudio.taragnolini](https://community.ofelia.com/u/claudio.taragnolini)\
**Post date:** [20 April 2017 07:40 UTC](https://community.ofelia.com/t/single-user-actor-filter/8400/1 "2017-04-20T07:40:42Z")

</div>

Hi, i would like to user the “Single User” Actor Filter.

I am storing the username of the user which i would like to assign the task on field.

How could i retrieve the Id from the username trought a script to put inside the “Single User” Actor Filter Id?

Thanks

---

<div class="post-metadata">

**Author:** ![Sean\_McP](https://dub1.discourse-cdn.com/flex013/user_avatar/community.ofelia.com/sean_mcp/32/932_2.png) [@Sean\_McP](https://community.ofelia.com/u/Sean_McP)\
**Post date:** [20 April 2017 08:46 UTC](https://community.ofelia.com/t/single-user-actor-filter/8400/2 "2017-04-20T08:46:07Z")

</div>

`
import org.bonitasoft.engine.api.IdentityAPI;
import org.bonitasoft.engine.identity.User;
`

`Long userid = identityAPI.getUserByUserName(userName.toLowerCase());
return userid.getId());
`

regards  
Seán

_PS: As this reply answers your question, please mark as resolved._

---

<div class="post-metadata">

**Author:** ![claudio.taragnolini](https://avatars.discourse-cdn.com/v4/letter/c/b9e5f3/32.png) [@claudio.taragnolini](https://community.ofelia.com/u/claudio.taragnolini)\
**Post date:** [26 April 2017 08:08 UTC](https://community.ofelia.com/t/single-user-actor-filter/8400/3 "2017-04-26T08:08:57Z")

</div>

Hi sorry but i am not achieving my goal.

i put this code inside the script of “Single User” actor filter:

import org.bonitasoft.engine.api.IdentityAPI;  
import org.bonitasoft.engine.identity.User;

Long userid = identityAPI.getUserByUserName(data.AreaManager);  
return userid.getId();

where data is the name of my process variable and AreaManager is the field which contain the username of the user which i want to assign the task.

---

<div class="post-metadata">

**Author:** ![Sean\_McP](https://dub1.discourse-cdn.com/flex013/user_avatar/community.ofelia.com/sean_mcp/32/932_2.png) [@Sean\_McP](https://community.ofelia.com/u/Sean_McP)\
**Post date:** [26 April 2017 11:18 UTC](https://community.ofelia.com/t/single-user-actor-filter/8400/4 "2017-04-26T11:18:20Z")

</div>

username is “walter.bates” or something similar that you sign in with.

Try that and then try to get the right data for your requirement…you’ll have to investigate for your issue, have you looked at the logs? What do they say…?

---

<div class="post-metadata">

**Author:** ![claudio.taragnolini](https://avatars.discourse-cdn.com/v4/letter/c/b9e5f3/32.png) [@claudio.taragnolini](https://community.ofelia.com/u/claudio.taragnolini)\
**Post date:** [26 April 2017 11:50 UTC](https://community.ofelia.com/t/single-user-actor-filter/8400/5 "2017-04-26T11:50:25Z")

</div>

Hi, yes i know, and i am giving the username.

Log says:  
org.bonitasoft.engine.core.filter.exception.SUserFilterExecutionException: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: Expression userId() with content = \<import org.bonitasoft.engine.api.IdentityAPI;  
import org.bonitasoft.engine.identity.User;  
Long userid = identityAPI.getUserByUserName(data.AreaManager);  
return userid.getId();\> depends on identityAPI is neither defined in the script nor in dependencies.
