Your First Business Process

Getting Started with WebRatio BPM Platform
1,078 views Published on Jul 24, 2015 | Time 7 min
Applies to: 8.0 or higher

Create your first Business Process application and discover the main features available for your application in WebRatio BPM Platform. Try yourself how easy and quick is to get your BPM application watching this tutorial.

Transcript

Table of contents

Introduction

Creating a simple BPM application is best way of getting started with business processes with WebRatio Platform. This lesson introduces WebRatio BPM Platform: the BPM based tool to quickly model and generate BPM applications! In this lesson we are going to build a purchase product BPM application! Let's start!

How to Create a BPMN Project

Click on "File" menu, choose the "New" and the "BPMN Project". Give a meaningful name for the BPMN Project, such as "ProductPurchase". Press the "Next" button and then on the "Finish" button.

How to Create a Business Process

The editor is now showing a canvas which you can use to draw the structure of your business processes. You add elements to the canvas after selecting them from the toolbar, which includes the elements of BPMN notation. By default the process contains already a process skeleton to start.

Let's start to define the parameters using in the "PurchaseProduct" process. Press the "Edit Process Parameter".

In this dialog, you can define the parameters to use the process. For this example, we need: the "Product", the "Quantity", the "Approval" and the "Delivery Date". Press the "Add" button, type a name for the Parameter, such as "Product". When you add all the parameters, press the "OK" button to confirm.

Now, we model a lane for each actor involved in the process:

  • The "Customer" that sends an order.
  • The "Supplier" that approves the order and sends the products.

Double-click on the "Lane 1" and give a meaningful name for the Lane, such as "Customer". To add the other lane, press on the "Add Lane" button and type a name for the second lane, such as "Supplier".

Now we define the single steps of the process in the Lanes, assigning each task to the right actor. The Start Event represents the first item activated by the Customer to start the Process, let's change it's name. Double-click on the Start Event and type a name for the Event, such as "New Order".

The first Task of the Customer refers to the order request. Let's define the Task. Double-click on the Task and give a name for the Task, such as "Edit Order". Let's associate to the Task the parameters requested to the Customer for an order: "Product" and "Quantity". Press the "Browse" button to choose the Parameters, choose the desidered parameters and for this parameters check the "Editable" property and the "Required" property. Then press the "OK" button to confirm.

The following step consists in the approval of the order by the Supplier. We need to define an other Task. Let's use a User Task. Click "Activities" section of the toolbar, choose the "User Task" item and click in the work area. Type a name for the task, such as "Approve Order".

The "Approval Order" task must be executed after the "Edit Order" task, let’s use the Sequence Flow. Select the outgoing flow by the "Edit Order" task and move to the "Approval Order" task.

Let's associate to the task the parameters that the Supplier can use to approve the order. Press the "Browse" button to choose the parameters, choose the desired parameters, in this case "Approval", "Product" and "Quantity". For the "Approval" parameter check the "Editable" property and the "Required" property. Then press the "OK" button.

Let's define two different paths to be followed whether the order is approved or not, for this purpose we will use a "Gateway" element. Click "Gateway" section of the toolbar, choose the "Exclusive" item, click in the work area and type a name for the gateway, such as "Verify Approval". Click "Sequence Flow" section of the toolbar, click first on the task and then click on the gateway.

When the order is not approved, the flow re-activates the "Edit Order" task, click "Sequence Flow" section of the toolbar, click first on the gateway then click on the task. Type a name for the Sequence Flow, such as "Not Approved". Check the "Default" property. Press the "Edit" button to set the expression to be verified, press the "Add" button, select the "Approval" parameter and press the "OK" button.

Otherwise, when the order is approved, the flow will activate a new task for the process the order. Click "Activities" section of the toolbar, choose the "ServiceTask" item and click in the work area. Type a name for the task, such as "Process Order".

Click "Sequence Flow" section of the toolbar, click first on the gateway and then click on the task. Type a name for the Sequence Flow, such as "Approved". Press the "Edit" button to set the expression to be verified, press the "Add" button, select the "Approval" parameter, choose the "True" value and press the "OK" button.

The "Process Order" calculates the delivery date and sends this information to the customer by email. This procedure will be done automatically from the application. To model the automatic procedure, let's configure the Service Task. Press the "Select All" button for this purpose and then press the "OK" button.

Press the "Action Definition" button to associate an action definition, click on the "Create new Action Definition" link, give a name for the action definition, such as "ProcessOrder". Click "Utility Components" section of the toolbar, choose the "Time" item and click in the work area to add it. Type a name for the operation, such as "Delivery Date". Click "Utility Components" section of the toolbar, choose the "Mail" item and click on the Success Flow to insert the operation. Type a name for the operation, such as "Send Mail". Press the "Edit" button to set the subject of the mail, write the subject, for example "Delivery Order" and then press the "OK" button. Press the "Edit" button to set the body of the mail, write the body and then press the "OK" button. Press the "Select" button to choose an SMTP Server, click on the "Create new SMTP Server" link, and configure the SMTP Server with your data. Then press the "Finish" button. Double-click on the Success Flow, uncheck the "Enable Default Binding" property and bind the date to the input parameter. Set the mail of the sender and the mail of the receiver, then press the "OK" button to confirm.

Move to the process. After the execution of the "Process Order" task the process ends. Let's move the "End Event" added in the "Customer" lane to the "Supplier" lane. Click "Sequence Flow" section of the toolbar, click first on the Task and then on the End Event.

Double-click on the End Event and type a name for the Event, such as "End Order".

Steps to Run a BPM Application

Press the "Generate and Run on Cloud" button to generate the project.

The BPM engine publishes a Rest API that can be used by Web and mobile applications to run the business processes. The API Rest are structured into groups, each of which contains the methods relating to the specific category. Let's see the steps to emulate the "PurchaseProduct" business process by using the defined methods in this page.

Let's use the "register" service to register on the BPM back-end application, the users: Customer and Supplier. Click on the "User Services" section and choose the "users/register" service. Choose the username and password for the Customer user, such as "customerName" and "customerPassword". Press the "Try it out!" button to run the service. In the Response Body, remember the oid of the Customer user to use in the next steps. Use the same procedure to register the Supplier user. Choose the username and password for the Supplier user, such as "supplierName" and "supplierPassword". Press the "Try it out!" button to run the service. Also in this case, in the Response Body, remember the oid of the Supplier user to use in the next steps.

We need to associate for each user the related role. To do that we use the token of the Administrator user, which is the only default registered user. Let's use the "login" service to retrieve the token and the "users/{userId}" PUT service method to set the role. Click on the "/users/login" service, use the credentials to login with the Administrator user and press the "Try it out!" button to run the service. In the Response Body, save the token related to the Administrator user. Click on the "/users/{userId}" service, set the token of the admin user, the key of the Customer user and set the role for the user, in this case the "Customer". Then press the "Try it out!" button to run the service. See the response: you can see that the "Customer" role is correctly set to the customer user. Use the same procedure to associate the role to the Supplier user. Set the key of the Supplier user and set the role for the user, in this case the "Supplier". Then press the "Try it out!" button to run the service. See the response: you can see that the "Supplier" role is correctly set to the supplier user.

Let's now start the business process. We need to login with the user Customer and retrieve the associated Start Event. Click on the "/users/login" service, use the credentials to login with the Customr user and press the "Try it out!" button to run the service. In the Response Body, save the token related to the Customer user.

Click on the "/users/me/process-definitions" service, set the token of the customer user and press the "Try it out!" button to run the service. In the Response Body, the Start Event name.

Let's now activate Start Event by using the "processes" POST Process Service. Click on the "Process Services" section, choose the "processes" service. Set the token of the Customer user and the event information. Press the "Try it out!" button to run the service. You can see that the first task "Edit Order" is ready to be activate. In the Response Body, save the oid of the "Edit Order" Task.

Let's active the "Edit Order" by using the "tasks/{taskId}" PUT service method. Click on the "Task Services" section and choose the "/tasks/{taskId}" service. Set the token of the Customer user, the Id of the Task to activate and the activation. Press the "Try it out!" button to run the service. You can see that the "Edit Order" is activate. Let's complete the task by setting the parameters related to the customer user. Set the parameters to complete the Task. Press the "Try it out!" button to run the service. The task is correctly completed and now the process is passed to the Supplier user.

Let's now start the "Approval Order" task. We need to login with the user Supplier and retrieve the associated task. Click on the "User Services" section, choose the "/users/login" service. Use the credentials to login with the Supplier user and press the "Try it out!" button to run the service. In the Response Body, save the token related to the Supplier user.

Click on the "/users/me/tasks" service, set the token of the supplier user and press the "Try it out!" button to run the service. You can see that the first task "Approval Order" is ready to be activate. In the Response Body, save tthe oid of the "Approval Order" task.

Let's active the "Approval Order" by using the "tasks/{taskId}" PUT service method. Click on the "Task Services" section and choose the "/tasks/{taskId}" service. Set the token of the Supplier user, the Id of the task to activate and the activation. Then press the "Try it out!" button to run the service. You can see that the "Approval Order" is activate. Let's complete the task by setting the parameters related to the supplier user. Set the parameters to complete the Task and press the "Try it out!" button to run the service.

The task is correctly completed and an email is sent to the customer with the delivery date of the order. See the email.