Build it yourself

Open IBM Process Designer, and import the start scenario named: ‘BPMBAL_Samples - BPMBAL_-_START_1.twx’

After having imported the ‘BPMBAL Samples’ process application, open it in IBM Process Designer by clicking on ‘Open in Designer’

image03

Click on the Business Process Diagram named ‘Int_LaptopOrder_EditAndFile’ listed on the right hand side.

Image04

In the BPD, we have already added a decision node named ‘Examine Laptop Order’, which was created using the activity wizard. Therefore the task type and its available input and output data sets are already created. We have as well connected the task to the other BPMN objects in the BPD, and the decision gateway will evaluate the result of the decision node to either branch to the ‘Validate Order’ subprocess, or not.

image05

However missing for sure is the BAL rule implementation – and therefore the decision service itself.

In this exercise you will create the BAL rule working on the task’s input and output data set to define under what conditions a manager approval of the laptop order is required.

Double click on the decision node to open its implementation, and select the variables  tab.

image05a

The BAL rule will investigate combinations of the ‘Order’ business data set, and then define whether the OrderProcessing.OrderManagerApprovalRequired variable is set to ‘true’ or ‘false’. For sure, this depends on the variable values of the laptop order itself, specified in editing the laptop order.

Save your changes.

Now switch to the diagram tab

image06

Because we want to create a BAL Rule, delete the existing ‘Rule’ node from the diagram, and drag and drop a ‘BAL Rule’ node from the palette between the Start and the End nodes.

image07

Name the new BAL rule ‘Examination’, and wire it to the Start and End node. Now, click the decision tab.

image08

The BAL rule editor opens.

image09

We want to specify the following rules requiring management approval:

  1. Whenever a non-IBM Thinkpad is ordered, manager approval is required
  2. Whenever an IBM Thinkpad is ordered no manager approval is required
  3. No matter what laptop is ordered, if the order total price is more than 1000, manager approval is required
  4. Whenever more than nine laptops are ordered, no matter what vendor or what process, manager approval is required
  5. Specify the customer discount factor depending on the number of laptops ordered

In all other cases, the manager does not need to approve the order.

Let’s see what needs to be done to specify these rules, beginning with the first rule.

Click on ‘condition’, and in the upcoming dialog select ‘the order item name of <an order>:

image10

On the next selection panel, select ‘Order’:

image11

On the next selection panel, select ‘does not contain <a string>

image12

On the next selection panel, select ‘string’

image13

Then in the BAL Rule in between the “” enter IBM

image14

This completes the condition. Next we are specifying the action.

Click on action, then select ‘make it <a Boolean> that <an order processing> is order manager approval required’

image15

On the next selection panel, select ‘true’

image16

On the next selection panel, select ‘that <an order processing>’

image17

On the next selection panel, select ‘OrderProcessing’

image18

On the next selection panel, select ‘is order manager approval required’

image19

Finally select to end the rule with a ‘;’, and your rule will look like that:

image20

Now, repeat almost the same steps, but this time define that if the string ‘IBM’ is included in the OrderItemName, that no management approval is required.

First, you need to add a new empty BAL rule. Click on the little ‘+’ sign at the top right corner of the editor:

image20a

When done, there are two BAL rules, and they look like that:

image21

Now, add a third rule defining that all laptop orders need to be approved by management if the order total price is more than 1000. When done, there is a third rule:

image22

Now, add a forth rule defining that for all orders coming with at least 10 management approval is required. Because Order.OrderItemNrOfPieces is a string (instead of e.g. an integer), we use a trick here to count the number of characters of that string. If the number of strings is ‘1’, than there are less than 10 items ordered, if the number of characters of that string is more than 1, than more than 9 laptops are ordered, and than we want the manager to approve the order.

When done, there is a forth rule:

image23

By the way: Rules leading to the sample action can as well be put together and combined using 'And' or 'Or' statements. For the sake of this exercise we will build rules with simple clauses only.

Next is to set the order customer discount factor to 0.3 if ten or more laptops are order, and to 0.1 if less than 10 laptops are ordered.

Perform the following steps to create the first rule:

First add a new empty rule.

image20a1

To get started, click on <condition>, then on the next selection panel, select ‘the length of <a string>

image24

On the next selection panel, select ‘the order item nr of pieces of <an order>’

image25

On the next selection panel, select ‘Order’

image26

On the next selection panel, select ‘is more than <a number>’

image27

On the next selection panel, select ‘<number>’

image28

When done enter ‘1’ as number (which then means that there are less than 10 items ordered).

Next define the action. Click on <action>, then on the next selection panel, select ‘set the order customer discount factor of <an order> to <a number>’

image29

On the next selection panel, select ‘Order’

image30

On the next selection panel, select ‘<number>’

image31

When done, enter ‘0.3’ as the number, which is the value of the process variable.

Finally, the BAL rule looks like that:

image32

The next rule to set the order customer discount factor to 0.1 if less than 10 laptops are ordered is done similarly.

When done, there are two additional rules:

image33

This completes the built it yourself section.

There should be the following six BAL rules defined, here’s a summary:

You can think about additional rules, and simply create them here in the editor.

You will probably agree, that defining BAL rules is easy to understand, the trick simply is to know what rules you need, and to understand the decision node’s input and output data set, as the terms used when defining the rules is directly bound to the names of the variables used in the input and output data sets.

By the way: All the BAL rules defined here in IBM Process Designer can be reused in IBM WebSphere ILOG jRules, once you find out that more business rules management capabilities are required within your organization. The editor used in IBM Process Designer, as well as the rule engine at runtime are directly encapsulated from the IBM WebSphere ILOG jRules rules engine, and everything done in IBM Process Designer with respect to decision services (as shown here) can be reused in IBM’s Business Rules Management offering.

You can export those rules by clicking on the export icon on the upper right side of the editor:

image34

The export procedure produces a complete business rules project suitable for continued work within JRules. After exporting the rules, importing into Rule Studio, and deploying the rules on a Rule Execution Server, the business process in IBM Process Designer can consume the resulting rule application using a remote decision service provided by JRules.

IBM WebSphere ILOG jRules offers to do much more with respect to business rules compared to what’s provided here in IBM Process Designer. One key feature for example is to change rules, rule sets and rule variables at runtime. For example one could change that management approval is only required for laptop orders which have a total order price of more than 2000, compared to 1000 as defined here in the sample. In IBM WebSphere ILOG jRules you can perform changes like from a rule console, without having to touch the BPD. Here in IBM Process Designer, changes like that need to be done in the tool, and therefore to the BPD.

This is it! Move on to the run the sample section.