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:

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.

    properties

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.

    start event

Next, create input parameters to prompt the user enter values to this form:

  • Click [align="center" and add requestNumber parameter with the following properties:

request number
  • 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:

form

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 append task icon icon.

  • Click the Change type change type icon icon and select User Task in the drop-down.

    user task
  • For this User task specify the following General properties:

    • Id: approval

    • Name: Approval

    • Assignee source: Process variable

    • Process variable: manager

      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 [align="center" 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 [align="center" 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 [align="center".

  • Set properties for the first outcome:

    outcome approve
  • 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 append gateway icon.

  • Select the gateway element and create another user task with append task iconchange type iconUser Task.

  • Select the gateway and click append end event icon to create EndEvent element.

  • Select the new sequence flows between elements and name them: approved and rejected.

The model should now look like this:

flows
  • Select the approved sequence flow and specify its Condition properties:

    • Condition source: User task outcome

    • User task id: Approval

    • User task outcome: approve

      flow approved
  • 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 save draft button button on the toolbar. You can open it any time later using open draft button button.
  • Go to the BPM → User groups view and create a new group named Accountants and set accountants as its code.

  • Set the user type to Users.

  • Add users to the group.

    user 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 edit button next to it.

  • In the Candidate group editor, add the Accountants group.

    groups
  • Configure an input dialog for the Payment task similarly to Approval 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 append end event icon after the Payment 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

      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.

    users start

Deploying Process

The process model is ready to be deployed to the process engine.

  • Go to the Modeler view.

  • Click Deploy process [align="center" 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.

    start process
  • Fill in the fields in the form and click the Start process button.

    start form

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.

    approval step
  • Review the request, and then click the Approve button.

    approval form

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.

    group task
  • Open the task form.

    payment task

    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.

    complete task

The process is now complete.