This content is dedicated to our next version. It is work in progress: its content will evolve until the new version is released.

Before that time, it cannot be considered as official.

Define who can do what

Up to this point, when you execute the process you are acting as a single user (username: walter.bates, password: bpm) who can perform all user tasks. In a scenario closer to a real life use case, there are different types of users: customers (who can submit claims), employees (who answer claims) and the manager of the user who provides the answer (who interacts with unsatisfied customers).

To define "who can do what," define the actors who can start a process perform a task or and map them to the "real" users in the organization.

The first step in the configuration of "who can do what" is to create lanes within the pool. We already have one default lane for employees. Let’s add another lane for customers, and another one for managers:

  1. In Bonita Studio, from the palette on the left hand side of the diagram select the lane icon

  2. Click inside the process pool to add the lane. Do this twice to have a total of three lanes

  3. Select the employee lane and click on the down arrow icon to move it, so it becomes the middle lane

    Add and organize lanes

  4. Select Lane1, go to the General  Lane tab, and rename it Customer lane

  5. Select Lane2, go to the General  Lane tab and rename it Manager lane

  6. Select the start event Submit claim and move it (via drag and drop) to the Customer lane. Do the same for the task Read the answer and rate it

  7. Select the Deal with unsatisfied customer task and move it to the Manager lane. Do the same with the end event End client unsatisfied

    Diagrams with lanes

A lane is used to group together user tasks that are to be done by the same set of users.

Now we need to define "actors," one for each lane, and map them to the lane they belong to:

  1. Select the pool

  2. Go to General  Actors

  3. Click on Add

  4. Click on the default name of the actor (Actor1) and change it to: Customer actor

  5. Repeat to create Manager actor

  6. Select the Customer actor and click on Set as initiator. This will add a flag on this actor, to mark it as the one who can start the process

    Add and rename actors

  7. Select Customer lane (click on the lane name)

  8. Go to General  Actors and in the drop down list, select Customer actor

  9. Do the same for the Manager lane with the Manager actor

    Map actor to lane

"Actor" identifies a collection of users. To define the actual users, we need to configure the actors and map them with groups, roles, users, etc of an organization. We will use the Bonita Acme test organization for this example:

  1. In the Bonita Studio coolbar, click on Configure

  2. Select Employee actor

  3. Click on Groups…​

  4. Unselect /acme

  5. Select /acme/production/services. We will identify this group of employee users as the support team in charge of answering claims. In the test organization, two users belong to this group: mauro.zetticci and thomas.wallis. The manager of both users is: michael.morrison

  6. Click on Finish

  7. Select Customer actor

  8. Click on Groups…​

  9. Select /acme/hr. We will use this group of users to act as customers who can submit claims. In the test organization, three users belong to this group: walter.bates, helen.kelly and april.sanchez

  10. Click on the Finish button

  11. Select Manager actor

  12. Click on Roles…​

  13. Select the member role. All users in the test organization have this role. (This is not important here, as this actor mapping will be overridden later in the configuration)

  14. Click on Finish

  15. Click on Finish to close the configuration window

At this stage, if you try to run the process, you will see that walter.bates can no longer perform the task Review and answer claim. You’ll have to go the the Bonita Portal and log out (click on Walter Bates in top right corner and select Logout) and log in again as mauro.zetticci or thomas.wallis (password: bpm) to be able to view the task. You’ll have to log out, and back in again with walter.bates's account, to be able to view the task that lets you read the provided answer.

Currently, the task Read the answer and rate it is available to all users in the group /acme/hr, but it should only be available to the user who started the process (walter.bates). Similarly, the task Deal with unsatisfied customer is available to everyone, when it should only be available to the manager of the user who completed the task Review and answer claim.
To refine this, we will configure an actor filters.

The actor filter produces a list of users based on input information and internal logic. It refines the actor configuration.
The actor filter will be executed when the process reaches a step to which the filter is mapped.

First configure the initiator actor filter:

  1. Select the Customer lane

  2. Go to General  Actors

  3. Click on Set…​ next to actor filter

  4. From the list, select Initiator

  5. Click on Next

  6. Set the name: User who submit the claim

  7. Click on Finish

    Configure initiator actor filter on Customer lane

Now we will configure the manager actor filter:

  1. Select Manager lane

  2. Follow the same steps as above, but this time select the user-manager actor filter

  3. Set the name: Manager of the user who provided answer

  4. Click on Next

  5. Click on the pencil icon

  6. Select Script and paste the following Groovy script (it will search for the id of the user who performed the task Review and answer claim):

    import org.bonitasoft.engine.bpm.flownode.ArchivedHumanTaskInstance
    import org.bonitasoft.engine.bpm.flownode.ArchivedHumanTaskInstanceSearchDescriptor
    import org.bonitasoft.engine.search.SearchOptionsBuilder
    import org.bonitasoft.engine.search.SearchResult
    
     def taskName = 'Review and answer claim'
    
     final SearchOptionsBuilder searchOptionsBuilder = new SearchOptionsBuilder(0, 1)
     .filter(ArchivedHumanTaskInstanceSearchDescriptor.PARENT_PROCESS_INSTANCE_ID, processInstanceId)
     .filter(ArchivedHumanTaskInstanceSearchDescriptor.NAME, taskName).filter(ArchivedHumanTaskInstanceSearchDescriptor.TERMINAL, true)
    
     SearchResult<ArchivedHumanTaskInstance> searchResult = apiAccessor.processAPI.searchArchivedHumanTasks(searchOptionsBuilder.done())
    
     final List<ArchivedHumanTaskInstance> tasks = searchResult.result
    
     tasks.first().executedBy
  7. Click on OK

  8. Click on Finish

    Configure user manager actor filter for manager lane

Run the process again, and this time only mauro.zetticci should have access to Review and answer claim and only michael.morrison should have access to Deal with unsatisfied customer (as the manager of both users who can complete the task Review and answer claim).

Now we have a fully customized process that processes data and dispatches tasks to appropriate users. The next step will be to make this process interact with the outside world.