Bonitasoft 6.2.6 how to assign specific user to next task

Hi,

I want to know if the user can assign the next task to specific user? I am using Bonitasoft 6.2.6 community.

Regards,
Terry

1 Like

Hello Terry,
you could use Actor filter - Single user that will allow you to do it by specifying its ID. So, you can allow one user to select a username for the next task, and then you can put a filter on the next task that will use this username to get its ID and assign the task to him/her. You can check more information in our documentation here .
You can also do it using APIs, there is a method assignUserTask that allows to assign a given human task to a certain user.
Hope this helps,
Haris

How do u exactly specify its use rid in actor filter ?

Hello may be this help you ,
i can explain how to give user to choice next task assign to which user
pl do following

Detail Process :

  1. create simple process with 2 tasks : start → task1 → tast2 → end
  2. create data variable : uId with type: Long
  3. step 1 → application → page-flow → add Page-flow (form)
  4. in page flow - > take one select box → select-box’s data tab → available value → paste following script

    import org.bonitasoft.engine.identity.*;

List users = apiAccessor.getIdentityAPI().getUsers(0, 200, UserCriterion.FIRST_NAME_ASC);
Map<String,Long> combo = new HashMap<String,Long>();

for(User u:users)
{
combo.put(u.getFirstName(),u.getId());
}

return combo

  1. in output operation :
    first filed - select that variable (uid) takes value of field - click on pencil (script) paste following

    def long l = Long.parseLong(field_Select1);

  2. task 2 → actor → set actor filter → add Uid variable

now run process .

(in task 1 user can see list of users , after it select any specific user ,
selected user’s id store into UID variable
task 2 use actor filter and get that UID and assigned that task to that specific user . )

Thanks
Kandarp

Hello

no it should be : java.util.map

thanks
kandarp

Thank you! it works!

Thanks for this!

Sorry for bothering ,but i don’t know how to use APIs ,could please help me ?

Hi Kandarp,

I followed your suggestion. But i got “Error while getting the form page list” while loading the first task with the select box. My codes in the first task, select box, groovy script as such.

![pic2][pic2]
[pic2]: http://i59.tinypic.com/sccm51.jpg

Is my return type correct?

Regards,
Terry

On the screenshot attached, you should use Map as return type (click on browse and search for Map, choose java.util.Map)

hellow.
I have the same error. How did you fix?

Hi,
I’ve succeeded in running the example.
I’d like to know why, if I press the Evaluate button, the system asks a value for the process variable apiAccessor. If I write anything in the box I get an ExpressionEvaluationException error

thaks,
Mirco

When using any system variable there is nothing there to evaluate, so it will ask you to give it a number.

To be honest except for the most basic stuff the Evaluate button is next to useless. You will be prompted for everything you need to make the code work. When you don’t have a running process there is nothing to grab on to, hence the *ExpressionEvaluationException * error.

for example, in script code

return x + y;

will ask you to provide values for x and y;

if you have a hand coded DB access with parameters (as below) for everything and a select statement you will be asked for (example only)

*Select userid, userfirstname,userlastname from ${tablename} where userid = ‘${userid}’
*

hostname
port
username
password
database
driver
tablename
userid

Hope that helps to complete your understanding,
regards
SeĂĄn