Thursday, July 21, 2016

How to create a BPMN Workflow with Human Tasks

This post applies to WSO2 Business Process Server 3.5.1

This post contains the steps that are required to create a simple BPMN workflow that contains a Human Task. We will use the WSO2 Developer Studio to create the BPMN workflow and WSO2 Business Process Server to deploy and host the workflow.

If you have not used the above mentioned products, please visit the product pages of Business Process Server and the Developer Studio get a general idea about the products. Also please refer to the documentation of Business Process Server and Developer Studio for more information.


Note:
The default distribution of the WSO2 Developer Studio does not pack all the required plugins to create the BPMN workflows. Since the BPMN support for WSO2 Business Process Server was added by integrating Activiti engine 5.19.0, with the BPS Server. The Developer Studio should install the Activiti Eclipse Designer plugin in-order to create the workflows.


  1.  Installing the Activiti Eclipse Designer plugin in Developer Studio

    Navigate to
    Help --> Install New Software

    Add the Activiti repository by clicking on
    "Add" button

    Give the repository URL and the Name and install the
    "Activiti BPMN Designer" related components

    Name : Activiti BPMN Designer
    URL : http://activiti.org/designer/update/

  2. Create a new Activiti Project


  3. Once the Activiti Project has been created, then we need to create a Activiti Diagram. Use the previously created project as the project for the diagram we are going to create.


  4. Now we can start creating the workflow. We are only going to create a simple workflow that contains a Human Task. We are going to have 3 input fields to the workflow

    User Name
    Order Items
    Description

    The Human Task would display all 3 values for the user to take action. Then the process would exit with the user action. We do not do anything else from this workflow as the main intention is to give a detail explanation of how the human tasks can be configured.

    A Start task can be added easily by using the tools platter that comes when working on the Activiti diagram.




    Also we can define the inputs for our workflow by navigating to the "form" section under properties of the start task.

    A sample input definition is given below.




    The final output definition looks as below.

  5. Now lets add a "User Task", This can be found under the tasks section of the tools platter. The User Task signifies the human task that needs to happen.



    In the user task there are multiple configurations that needs to be done.

    - Configure the users/roles that the task needs to be assigned.
    The "main config" section under the properties allows us to define the users and roles that these tasks should be assigned to.In this example, we assign all the tasks for the "admin" user.

    In the main config section, the Assignee field defines the user name of the default assignee. Since we are assigning all these for the admin user in this example we set the value of that field to admin.
    The Candidate us...a separated) and Candidate gr...a separated) fields defines the list of users and roles that the tasks needs to be assigned respectively. A comma separated list of user names and roles names can be given to each filed respectively.

    - Configure the inputs and outputs to the User Task
    We have to define the inputs and outputs of the user task as we did for the start event. These inputs can be taken from the values that was received at the start of the workflow(or from any responses of the intermediate tasks if there were any).




    We can use the Variable field to define which variable we should take these values from.

    Similarly we can define the output values as well. We have defined the output as a enum type and defined 3 actions that the user can take.

    Approve
    Disapprove
    Discard




    The final input/output definition is as follows.

  6. We end the workflow by adding a End task. Also we have to give a meaningful name for the workflow we are creating. This can be done by clicking on the canvas area and changing the Name and Id fields under process section of properties.

  7. Now our simple workflow is complete and we need to create a deployable artifact out of that. This can be done by right clicking on the project(note that you have to be in the package view) and selecting the "Create deployment artifacts" option at the end. Once you complete this, a deployment artifact(OrderApprovalProcess.bar) would be created under the deployment directory of the project.

I will explain how to deploy this artifact in the Business Process Server and test it using the defaul bpmn-dashboard that comes with the product from my next post.

3 comments:

  1. If you're looking to lose weight then you certainly have to jump on this brand new custom keto meal plan diet.

    To create this keto diet, certified nutritionists, fitness trainers, and cooks have joined together to develop keto meal plans that are productive, decent, cost-efficient, and delicious.

    Since their launch in early 2019, 1000's of clients have already transformed their body and health with the benefits a certified keto meal plan diet can provide.

    Speaking of benefits: in this link, you'll discover eight scientifically-confirmed ones offered by the keto meal plan diet.

    ReplyDelete
  2. What a fantabulous post this has been. Never seen this kind of useful post. I am grateful to you and expect more number of posts like these. Thank you very much. ewapoker

    ReplyDelete
  3. Nice post! It is really interesting and wonderful. Thanks for sharing.

    Process server NJ

    ReplyDelete