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:
-
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 becomes 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 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:
-
Select the pool
-
Go to
-
Click on Add
-
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. This will add a flag on this actor, to mark it as the one who 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" 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:
-
In the Bonita Studio menu, click on the
-
Select Employee actor
-
Click on Groups…
-
Unselect /acme
-
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
-
Click on Finish
-
Select Customer actor
-
Click on Groups…
-
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 Roles…
-
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)
-
Click on Finish
-
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 actor filters.
The actor filter produces a list of users based on input information and internal logic. It overrides the actor configuration. |
First configure the initiator actor filter:
-
Select the Customer lane
-
Go to
-
Click on Set… next to actor filter
-
From the list, select Initiator
-
Click on Next
-
Set the name: User who submit the claim
-
Click on Finish
Now we will configure the manager actor filter:
-
Select Manager lane
-
Follow the same steps as above, but this time select the user-manager actor filter
-
Set the name: Manager of the user who provided answer
-
Click on Next
-
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
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.