Creating Process in Web Application
Business analysts can create process models directly in the web application using a Modeler. If the process doesn’t involve development of Java code, it can be deployed and executed fully in web environment.
Let’s create our bpm:getting-started.adoc#sample-process using web tools only.
Modeling Process in Web
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 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 to 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.
-
-
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
false
expenseAmount
Expense amount
Decimal (double)
false
false
expenseDate
Expense Date
Date
false
false
document
Document
File
false
false
-
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 the 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 a 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.
Now you can start and test your process, go to the next section.