Skip to content

Latest commit

 

History

History
80 lines (53 loc) · 5.3 KB

decision-automation.md

File metadata and controls

80 lines (53 loc) · 5.3 KB
title Decision Automation
sidebar_position 6
description Learn how to integrate DMN decision tables in the Process.

Leverage business rules (6/6)

In this section, you'll learn how to add decision automation to your process by using BPMN 2.0 Business Rule Tasks and DMN 1.3 Decision Tables.

Add a Business Rule Task to the Process

Use the Operaton Modeler to open the Payment Retrieval process, then click the Approve Payment Task. Change the activity type to Business Rule Task in the wrench button menu.

Example image

Next, link the Business Rule Task to a DMN table by changing Implementation to DMN and Decision Ref to approve-payment in the properties panel. To retrieve the result of the evaluation and save it automatically as a process instance variable in our process, we also need to change the Result Variable to approved and use singleEntry as the Map Decision Result in the properties panel.

Example image

Save your changes and deploy the updated process using the Deploy button in the Operaton Modeler.

Create a DMN table using the Operaton Modeler

First, create a new DMN diagram by clicking File > New File > DMN Diagram. Example image

Now the newly created diagram will already have a decision element added to it. Select it by clicking it and then give it a name of Approve Payment and an ID of approve-payment (the decision ID must match the Decision Ref in your BPMN process). Example image

Next, create a new DMN table by clicking the table button. Example image

Specify the DMN table

First, specify the input expressions for the DMN table. In this example, we'll decide whether a payment is approved based on the item name. Your rules can also make use of the FEEL Expression Language, JUEL or Script. If you like, you can read more about Expressions in the DMN Engine.

Double click Input to configure the input column. Use Item as the Input Label and item as the Input Expression: Example image

Next, set up the output column. Use Approved as the Output Label and approved as the Output Name for the output column "Approved": Example image

Let's create some rules by clicking on the plus icon on the left side of the DMN table. We should also change the Output Column to the Data Type boolean: Example image

After setup, your DMN table should look like this: Example image

Deploy the DMN table

To deploy the decision table, click the Deploy button in the Operaton Modeler, give it the deployment name "Payment Retrieval Decision", then click the Deploy button. Example image

Verify the Deployment with Cockpit

Now, use Cockpit to see if the decision table was successfully deployed. Go to http://localhost:8080/operaton/app/cockpit/. Log in with the credentials demo / demo. Navigate to the "Decisions" section. Your decision table Approve Payment should be listed as deployed decision definition.

Example image

Inspect using Cockpit and Tasklist

Next, use Tasklist to start two new process instances and verify that depending on your input, the process instance will be routed differently. To do so, go to http://localhost:8080/operaton/app/tasklist/. Log in with demo / demo.

Click on the Start process button to start a process instance and choose the Payment process. Use the generic form to add the variables as follows: Example image

Hit the Start Instance button.

Next, click again on the Start process button to start another process instance and choose the Payment process. Use the generic form to add the variables as follows: Example image

You'll see that depending on the input, the worker will either charge or not charge the credit card. You can also verify that the DMN tables were evaluated by using Operaton Cockpit. Go to http://localhost:8080/operaton/app/cockpit/. Log in with the credentials demo / demo. Navigate to the "Decisions" section and click on Approve Payment. Check the different decision instances that were evaluated by clicking on the ID in the table.

A single DMN table that was executed could look like this in Operaton Cockpit: Example image

:::note[Success!] Congratulations! You've successfully completed the Operaton Platform Quick Start. Ready to continue? We recommend the Operaton Platform documentation. :::