Getting Started with BPM
This section describes how to model and run a simple business process. For that, we will create a process for requesting and approving reimbursement.
The process involves three participants:
-
an employee who requests a reimbursement;
-
a manager who approves the reimbursement;
-
an accountant who processes payment upon approval.
In terms of BPM, we will be building the following model:
Modeling Process
Start the application and open the BPM → Modeler view. The right panel contains a list of properties for the current process.
For our reimbursement process enter the following values:
-
Process id:
reimbursement
-
Name:
Reimbursement
-
Documentation: Add a short description for the process.
Creating Start Form
Each element on the canvas has its own properties. At the moment the only element present is StartEvent
. It represents the Start form seen by the user who is initiating the process. Let’s configure it:
-
Click on the
StartEvent
element to select it. -
Select
Input dialog
in the Form Type field. Its Open mode is automatically set to Dialog.
Next, create input parameters to prompt the user enter values to this form:
-
Click and add
requestNumber
parameter with the following properties:
-
Repeat the previous step to create three more input parameters:
Process variable Caption Type Editable Required expenseAmount
Expense amount
Decimal (double)
true
true
expenseDate
Expense Date
Date
true
true
document
Document
File
true
true
-
Next, create an input parameter to let users select a manager for approval. This will require a few additional properties:
Process variable Caption Type Editable Required Entity name UI Component JPQL query manager
Manager
Entity
true
true
User
ComboBox
leave blank*
* If no query is specified, this field defaults to
select e from User e
. -
Set
requestNumber
as the Business key field value. A business key is a domain-specific identifier of a process instance.
After adding all the parameters, the Form section should look as follows:
Creating Approval Task
Create a task for approval. It will be represented by the Approval form seen by the manager assigned to approve the reimbursement.
First, add a new element on the canvas:
-
Click on the
StartEvent
element to select it. -
Click the Append task icon.
-
Click the Change type icon and select User Task in the drop-down.
-
For this User task specify the following General properties:
-
Id:
approval
-
Name:
Approval
-
Assignee source:
Process variable
-
Process variable:
manager
By default, the built-in initiator
process variable is available to assign a task. See the corresponding section for more details.
-
-
Proceed to the Form section and specify the following properties:
-
Form type:
Input dialog
-
Open mode:
Dialog
(this will be set by default)
-
-
Click and add the following existing parameters making them non-editable:
Process variable Caption Type Editable Required requestNumber
Request number
String
false
true
expenseAmount
Expense amount
Decimal (double)
false
true
expenseDate
Expense Date
Date
false
true
document
Document
File
false
true
-
Click and create one additional parameter for this form:
Process variable Caption Type Editable Required comment
Comment
Multiline string
true
false
This parameter will be represented by a text field allowing manager to leave notes during the approval step.
Creating Outcomes
The Approval step has two outcomes: approved or rejected. Therefore, the manager making decision should see two buttons on the form.
-
Make sure the Approval element is selected. Then go to Outcomes properties and click .
-
Set properties for the first outcome:
-
Repeat to create the second outcome:
Business id Caption Icon reject
Reject
BAN
Depending on the Approval task’s outcome, two scenarios are possible. To indicate a point with several alternative paths, add an Exclusive Gateway element:
-
Select the Approval task element and click Append Gateway .
-
Select the gateway element and create another user task with → → User Task.
-
Select the gateway and click to create
EndEvent
element. -
Select the new sequence flows between elements and name them:
approved
andrejected
.
The model should now look like this:
-
Select the
approved
sequence flow and specify its Condition properties:-
Condition source:
User task outcome
-
User task id:
Approval
-
User task outcome:
approve
-
-
Similarly, specify Condition properties for the
rejected
sequence flow:-
Condition source:
User task outcome
-
User task id:
Approval
-
User task outcome:
reject
-
Creating Payment User Task
The other user task in our model is to notify accountants about reimbursement payment approval. It will be represented by the Payment form available only to accountants.
-
Select the user task on the canvas then set its Id and Name:
-
Id:
payment
-
Name: Payment
-
For this task we will implement the following behavior: it is sent to all accountants with any of them being able to claim this task. To achieve this, instead of a particular assignee there is an option to specify Candidate groups or Candidate users.
Therefore, let’s create a Candidate group for accountants.
Before leaving Modeler, save your model as draft with button on the toolbar. You can open it any time later using button. |
-
Go to the BPM → User groups view and create a new group named
Accountants
and setaccountants
as its code. -
Set the user type to Users.
-
Add users to the group.
Users involved in the processes must be granted the BPM: process actor role. This role provides access to BPM views and entities required for starting processes and working with user tasks. You can assign roles in the Application → Users view.
|
-
Go back to the modeler and select the
Payment
user task. -
Find the Candidate groups property field and click the edit button next to it.
-
In the Candidate group editor, add the
Accountants
group. -
Configure an input dialog for the
Payment
task similarly toApproval
task. Set the following properties:-
Form type:
Input dialog
-
Open mode:
Dialog
(this will be set by default)
-
-
Add input parameters. They match the parameters on the Approval form but the comment field should be non-editable too:
Process variable Caption Type Editable Required requestNumber
Request number
String
false
true
expenseAmount
Expense amount
Decimal (double)
false
true
expenseDate
Expense Date
Date
false
true
document
Document
File
false
true
comment
Comment
Multiline string
false
false
-
Go back to the canvas and add the
EndEvent
element after thePayment
task.
Specifying Users to Start Process
To start a process the user must belong to a special user group. In our case, such group will contain all users.
-
Open the User groups view and create a new group with the following properties:
-
Name: All users
-
Code: all-users
-
Type: All users
-
-
Go back to the Modeler view and click anywhere on the canvas to display the process properties.
-
Set Candidate groups to
All users
in the Starter candidates section.
Deploying Process
The process model is ready to be deployed to the process engine.
-
Go to the Modeler view.
-
Click Deploy process on the toolbar.
-
Open the BPM → Start Process view.
New Reimbursement process should now be available on the list. This list provides all deployed processes that the current user can start.
Testing Process
Now that the process is modeled and deployed it can be started. Let’s go through it step by step, observing all the forms we have created.
Start Form
With the current settings, the process can be started by any user on the BPM → Start Process view.
-
Select the Reimbursement process and click the Start process button.
-
Fill in the fields in the form and click the Start process button.
The assigned manager will then receive an incoming approval task.
Approval Form
Let’s see how this process looks from the manager’s standpoint. On the previous step, manager james was assigned to approve the request.
-
Log in on behalf of the manager assigned to approve the request.
-
Navigate to the BPM → My Tasks view.
-
Select the task from the list and click the Open Task button.
-
Review the request, and then click the Approve button.
Upon approval, the request will be sent to an accountant, who will then take care of payment.
Payment Form
Accountants will see reimbursements to be paid in their Group tasks.
-
Log in on behalf of any user who is a member of the Accountants user group.
-
Open the BPM → My Tasks view. Expand the Group tasks node.
-
Open the task form.
Fields in this form remain read-only until the task is claimed.
-
Claim the task using one of the two options:
-
Click Claim and resume button to proceed with this task right away. This will remove the task from the Group list and the Complete button will appear.
-
Click Claim and close to claim the task while postponing its completion. This will close the form and move the task from Group tasks to the current user’s Assigned tasks list. After that the task is no longer visible to other accountants.
-
-
Click the Complete task button to finish the process. This button is added by default to any task that does not have outcomes specified.
The process is now complete.