Centurion, South Africa info@code2bits.com On Request

How to Model a Simple BPMN Flow using Camunda Modeler

This post contains a step-by-step guide on how to create a simple BPMN flow using Camunda Modeler. The BPMN flow is called “Personal Message” and contains a single user task where a person will type a personal message within a form.

Getting Started

The following list defines the technologies and libraries I used to implement the sample code:

Code Example

The code example can be downloaded from Github from the button below. After you have downloaded the code onto your machine, you can open the file in Camunda Modeler.

Download Code

Step 1: Create a New BPMN Diagram

The first step is to create a new BPMN Diagram. There are several options to perform this task; the simplest is to make use of the new diagram button and select the Create new BPMN Diagram menu option. Alternatively, you can make use of the menu options in the following order:

  • File > New File > BPMN Diagram

Click To Enlarge

Step 2: Save the BPMN Diagram

The second step is to save the BPMN Diagram to ensure that you do not accidentally lose your work. Again there are several options, but the simplest is to make use of the save diagram button. You can also make use of the menu options in the following order:

  • File > Save File

I saved the BPMN diagram as personal_message.bpmn on my personal computer.

Click To Enlarge

Step 3: Set Process Properties

Ensure that you click anywhere on the canvas so that none of the elements are selected. On the left of the modeling canvas, there is a panel that contains all the properties. Once you have selected the General tab, you will see the properties of the process called Id, Name, Version Tag, etc.. Set the properties with the following values:

  • Id: personal_message
  • Name: Personal Message
  • Version Tag: 1.0.0
  • Executable: Ticked (Yes)

Click To Enlarge

Step 4: Name the Start Event

The Start Event is modeled as a circle and is already placed by default on the modeling canvas. To name this event, you can double click on the event and type in the name of the event. You can also click on it once, and set the name in the properties panel under the General tab.

  • Name: Retrieve Personal Message

Click To Enlarge

Step 5: Create and name the Task

The next step is to append a task to the Start Event. Once you have clicked on the event once, you will see multiple options to the right of the event. You can select the Append Task option which will create a task as the next step of your flow. To name this task, you can double click on the task and type in the name of the task. You can also click on it once, and set the name in the properties panel under the General tab.

  • Name: Create Personal Message

Click To Enlarge

Step 6: Change Task Type to User Task

Task types specify the nature of the action that will be performed as part of the process. In this example, we will change the task to a User Type. Click on the task once to see the multiple options (icons) to the right of the task. The wrench icon allows you to change the type of the task. Select the User Task option from the menu after you have clicked on the wrench icon.

Click To Enlarge

Step 7: Set the Task Properties (General)

Ensure that you click on the user task to display the properties of the task in the properties panel. Once you have selected the General tab, you will see the properties of the task called Id, Name, etc.. Set the properties with the following values:

  • Id: create_personal_message
  • Name: Create Personal Message
  • Assignee: {starlord}

The assignee property should contain the name of the user you have configured in your Camunda runtime environment who will use the Tasklist to create a personal message. I have a user called starlord that I will use to sign in to the Admin console.

Click To Enlarge

Step 8: Set the Task Properties (Forms)

After you have set the general properties of the user task called Create Personal Message, you must also configure the field’s elements the user will see in the Tasklist. Ensure that you are on the Forms tab of the properties panel. Next is to click on the plus (“+”) icon next to the Form Fields property. Add the following values into the properties of the newly created form field:

  • Id: personal_message_field
  • Type: string
  • Label: Personal Message
  • Default Value: Hello World !!!

Click To Enlarge

Step 9: Create End Event

The final step is to create an End Event for our process. Click on the user task once to see the multiple options (icons) to the right of the task. Select the dark bold circle the append an End Event after the task. To name this event, you can double click on the event and type in the name of the event. You can also click on it once, and set the name in the properties panel under the General tab.

  • Name: Personal Message Retrieved

Click To Enlarge

Remember: Save the Process

As you have already saved the process to a specific file, you can only click on the Save icon in the toolbar. Alternatively, you can make use of the menu options in the following order:

  • File > Save File

Summary

Congratulations! You have successfully modeled a simple process in the Camunda Modeler. This process contains a single “User Task” that will allow the user to type a personal message. Follow me on any of the different social media platforms and feel free to leave comments.