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.

    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 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 to 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.
  • 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

    false

    expenseAmount

    Expense amount

    Decimal (double)

    false

    false

    expenseDate

    Expense Date

    Date

    false

    false

    document

    Document

    File

    false

    false

  • 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 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 [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 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

      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.

Now you can start and test your process, go to the next section.