This documentation is about a version that is out of support, here is the latest documentation version.

How about downloading a newer, supported version?

Define who can do what

Up to this point, when you execute the process you were acting as a single user (username: walter.bates, password: bpm) who can perform all the 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 is needed to interact with unsatisfied customers).

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

  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 is 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 should 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 the Add button

  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 button. This will add a flag on this actor to mark it as the one 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 are just identifiers. In order to define the actual user, we need to configure the actors and map them with groups, roles , users, etc of the organization. We will use the Bonita Acme test organization for this example:

  1. In the Bonita Studio menu, click on the Server  Configure Configure button icon

  2. Select Employee actor

  3. Click on the Groups…​ button

  4. Unselect /acme

  5. Select /acme/production/services. We will use this group of users to act as 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 the Finish button

    Configure actor mapping for customer actor

  7. Select Customer actor

  8. Click on the Groups…​ button

  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 the Roles…​ button

  13. Select the member role. All users in the test organization have this role. But this does not really matter as this actor mapping will be override later in our configuration

  14. Click on the Finish button

  15. Click on the Finish button 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 logout from the Bonita Portal (click on Walter Bates in top right corner and select Logout) and log in with mauro.zetticci or thomas.wallis (password: bpm) to be able to view the task. And you need to log back in with walter.bates account to be able to view the task that let 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 will be available to everyone when it should only be available to the manager of the user who completed the task Review and answer claim. To address this, we will configure actor filters:

  1. Select the Customer lane

  2. Go to General  Actors

  3. Click on the Set…​ button next to actor filter

  4. From the list, select Initiator

  5. Click on the Next button

  6. Set the name: User who submit the claim

  7. Click on the Finish button

    Configure initiator actor filter on Customer lane

  8. Select Manager lane

  9. Follow the same steps but select the user-manager actor filter

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

  11. Click on the Next button

  12. Click on the pencil icon

  13. 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
  14. Click on OK

  15. Click on Finish

    Configure user manager actor filter for manager lane

If you run the process again, only walter.bates should have access to Read the answer and rate it and only michael.morrison should have access to Deal with unsatisfied customer (as he is 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.