Add a User Task to the Process
In this section, you’ll learn how to involve humans in your process by using BPMN 2.0 User Tasks.
Add a User Task
We want to modify our process so that we can involve humans.
To do so, open the process in the Camunda Modeler.
Next, from the Modeler’s left-hand menu, select the activity shape (rectangle) and drag it into position between the Start Event and the “Charge Credit Card” Service Task. Name it Approve Payment.
Change the activity type to User Task by clicking on it and using the wrench button menu.
Configure a User Task
Next, open the properties view. If the properties view is not already visible, click on the “Properties Panel” label on the right-hand side of the Modeler canvas.
Select the User Task on the canvas. This will update the selection in the properties view. Scroll to the property named
Configure a basic form in the User Task
This step will also take place in the properties panel. If the panel is not already visible, click on the “Properties Panel” label on the right-hand side of the Modeler canvas.
Select the User Task on the canvas. This will update the selection in the properties view.
Click on the Tab
Forms in the properties panel.
Add three form fields by clicking on the
- ID: amount
- Type: long
- Label: Amount
- ID: item
- Type: string
- Label: Item
- ID: approved
- Type: boolean
- Label: Approved?
Deploy the Process
Deploy Button in the Camunda Modeler to deploy the updated process to Camunda.
Work on the Task
Go to Tasklist (http://localhost:8080/camunda/app/tasklist) and log in with the credentials “demo / demo”. Click on the button to start a process instance. This opens a dialog where you can select Payment Retrieval from the list. Now you can set variables for the process instance using a generic form.
The generic form can be used whenever you have not added a dedicated form for a User Task or a Start Event. Click on the Add a variable button to create a new row. Fill in the form as shown in the screenshot. When you’re done, click Start.
You should now see the Approve Payment task in your Tasklist. Select the task and click on the Diagram tab. This displays the process diagram highlighting the User Task that’s waiting to be worked on.
To work on the task, select the Form tab. Because we defined the variables in the Form Tab in the Camunda Modeler, the Tasklist has automatically generated form fields for us.
Next, we’ll make the process more dynamic and only show a User Task in certain situations. Let’s have a look how you can add Gateways to your Process.
Catch up: Get the Sources of Step-3.
You can checkout the current state from the GitHub repository.
If you have not cloned the repository yet, please execute the following command:
git clone https://github.com/camunda/camunda-get-started-quickstart.git
To checkout the current state of the process application please execute the following command:
git checkout -f Step-3Or download as archive from here.