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:
-
In Bonita Studio, from the palette on the left hand side of the diagram select the lane icon
-
Click inside the process pool to add the lane. Do this twice to have a total of three lanes
-
Select the employee lane and click on the down arrow icon to move it, so it is the middle lane
-
Select Lane1, go to the
tab, and rename it Customer lane -
Select Lane2, go to the
tab and rename it Manager lane -
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
-
Select the Deal with unsatisfied customer task and move it to the Manager lane. Do the same with the end event End client unsatisfied
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:
-
Select the pool
-
Go to
-
Click on the Add button
-
Click on the default name of the actor (Actor1) and change it to: Customer actor
-
Repeat to create Manager actor
-
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
-
Select Customer lane (click on the lane name)
-
Go to
and in the drop down list, select Customer actor -
Do the same for the Manager lane with the Manager actor
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:
-
In the Bonita Studio menu, click on the
-
Select Employee actor
-
Click on the Groups… button
-
Unselect /acme
-
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
-
Click on the Finish button
-
Select Customer actor
-
Click on the Groups… button
-
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
-
Click on the Finish button
-
Select Manager actor
-
Click on the Roles… button
-
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
-
Click on the Finish button
-
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:
-
Select the Customer lane
-
Go to
-
Click on the Set… button next to actor filter
-
From the list, select Initiator
-
Click on the Next button
-
Set the name: User who submit the claim
-
Click on the Finish button
-
Select Manager lane
-
Follow the same steps but select the user-manager actor filter
-
Set the name: Manager of the user who provided answer
-
Click on the Next button
-
Click on the pencil icon
-
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
-
Click on OK
-
Click on Finish
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.