Single user Actor Filter

1
0
-1

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

2 answers

1
+1
-1
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.

1
0
-1

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.

Comments

Submitted by Sean McP on Wed, 04/26/2017 - 13:18

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...?

Submitted by claudio.taragnolini on Wed, 04/26/2017 - 13:50

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.identity.User;
Long userid = identityAPI.getUserByUserName(data.AreaManager);
return userid.getId();> depends on identityAPI is neither defined in the script nor in dependencies.

Notifications