How can I assign a human task to all users in pool's actors?

1
0
-1

I'm trying to assign a task to all users in a group but only the first who takes the task can actually do it, but what I need is ALL the users in that group to do the same task.

Thank you in advance.

Comments

Submitted by Dibyajit.Roy on Fri, 11/24/2017 - 19:18

Hello

You need to use Multi-instantiation tasks. You can assign same task to multiple users. Its like creating the same copy for all the users. But all users must do the task to complete the process, else it will still be pending with those who have not done the task.
To make sure the first person who takes the task, and it gets removed from other uers, there is something called EARLY COMPLETION CRITERIA.
use Multi-instantiation to address your scenario

reagrds

Submitted by alberto.illobre... on Sun, 11/26/2017 - 13:26

Hi,

I'm new to bonita so I'm sure I'm doing something wrong but I tried to do it using a list of users in a group:
- I created a new group (name= test, display name Test) in the acme organization
- Added to helen kelly and william jobs a membership to this new group
- In the task I want to assign to multiple users:
- Iteration: parallel multi-instantiation
Create instances from a list*

  • the list is created as follows (found an example in the documentation):
    import org.bonitasoft.engine.api.IdentityAPI
    import org.bonitasoft.engine.identity.Group
    import org.bonitasoft.engine.identity.User
    import org.bonitasoft.engine.search.SearchOptionsBuilder
    import org.bonitasoft.engine.search.SearchResult

String org_path = "/acme/test";
Group gp=apiAccessor.getIdentityAPI().getGroupByPath(org_path);

final IdentityAPI identityAPI = TenantAPIAccessor.getIdentityAPI(apiSession);
final SearchOptionsBuilder builder = new SearchOptionsBuilder(0, 100);
builder.filter(UserSearchDescriptor.GROUP_ID, gp.id);
final SearchResult userResults = identityAPI(apiSession).searchUsers(builder.done());

Thank you for the help.

Submitted by alberto.illobre... on Sun, 11/26/2017 - 13:26

Hi,

I'm new to bonita so I'm sure I'm doing something wrong but I tried to do it using a list of users in a group:
- I created a new group (name= test, display name Test) in the acme organization
- Added to helen kelly and william jobs a membership to this new group
- In the task I want to assign to multiple users:
- Iteration: parallel multi-instantiation
Create instances from a list*

  • the list is created as follows (found an example in the documentation):
    import org.bonitasoft.engine.api.IdentityAPI
    import org.bonitasoft.engine.identity.Group
    import org.bonitasoft.engine.identity.User
    import org.bonitasoft.engine.search.SearchOptionsBuilder
    import org.bonitasoft.engine.search.SearchResult

String org_path = "/acme/test";
Group gp=apiAccessor.getIdentityAPI().getGroupByPath(org_path);

final IdentityAPI identityAPI = TenantAPIAccessor.getIdentityAPI(apiSession);
final SearchOptionsBuilder builder = new SearchOptionsBuilder(0, 100);
builder.filter(UserSearchDescriptor.GROUP_ID, gp.id);
final SearchResult userResults = identityAPI(apiSession).searchUsers(builder.done());

Thank you for the help.

Submitted by Dibyajit.Roy on Sun, 11/26/2017 - 13:46

Hi
You got most of the Process Correct. You just need to make small changes to make it work.
Here is how I use Multi-Instantiation.
1) Create a process Variable of type Text and isMultiple as checked.
2) Store the Users from the Group to the variable. what I do here is that I have a form. I display all the members from the group in the form. I use checkbox to select multiple users. and using Operations I save the selected users in the Variable.
This can be done by mapping the Variable directly with the Task contract.
Hence my variable has values like "helen,kelly,walter.bates,william.jobs" .
You can manually enter the values for Testng purposes.
3) Here is the important step.
in the iteration - select create instance from list .
Use the dropdown to select the variable that you had created in step one.
in the Textbox for iterator, give a name like actors or requester . Some thing that makes sense to you.
and type is java.lang.String
Now You need to use Actor filter for the same task.
Use the Single user option.
You can use the below code.

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

IdentityAPI identity = apiAccessor.getIdentityAPI();
User user = identity.getUserByUserName(actor or Requesters);

return user.getId();

This should do it.
Let me know if you have issues. Share the BOS file with Bonita Version name and I will try to see if I can fix it for you.

Regards

Submitted by alberto.illobre... on Sun, 11/26/2017 - 17:31

Hi again,

I've tried to follow your steps but I still can't make it work. The only thing I made different is the selection of the users: I'd like to select them using a script, that's why I created a group and I was trying to select all users in that group. Here's my BOS file (Bonita 7.5):
https://www.dropbox.com/s/hayejzwvozjiskq/Test-1.0.bos?dl=0

Submitted by Dibyajit.Roy on Sun, 11/26/2017 - 18:09

Hey Bro

You did everything correct. I just added a step before the Multi-instantiation and the Process is Working like a charm.
The link is https://www.dropbox.com/s/nqv53ib9sqdzk8v/Test-1.0.bos?dl=0

Download and run the Process. Let me know if any issues comes up.

Just note that I have removed the script from the Test Variable.
Step 1 has contract , form and Operations. Just check them out.

Regards

Submitted by alberto.illobre... on Sun, 11/26/2017 - 18:55

Hi,

It works but that's not exactly what I was looking for. I wanted to assign the task to all the users in the group without selecting the users manually in the form. In other words, I wanted to initialize the list of users automatically from a script. Is it possible to do it without filling the form?

Thanks.

Submitted by Dibyajit.Roy on Sun, 11/26/2017 - 19:12

Yes, we can do load all the users from a group and assign the task directly to all of them.
But I dont have any examples right now. To do that, we need to experiment with identity API.
But the way I see, your problem with Multi-instantiation is solved. I hope you have a better understanding of the idea.
Now you have to find a solution to the Problem of using groovy script to load members from a Group and add them to the Process Variable. For this, you should raise a new question in the Community.
I am sure someone out there will have a solution for you.

Regards

No answers yet.
Notifications