Oracle Process Cloud Service Composer: Creating Business Rules


Options



Before You Begin

Purpose

This tutorial shows you how to create if/then and decision table business rules and assign them to a process flow element in Oracle Process Cloud Service Composer.

Time to Complete

Approximately 45 minutes

Background

Oracle Process Cloud Service is a cloud-based software development Platform as a Service (PaaS) that provides a hosted environment for your process applications. Oracle Process Cloud Service has two main environments: In Workspace, end users perform process tasks, and administrators monitor process performance. In Composer, developers create, test, and manage the life cycle of applications. Applications developed in Composer are deployed to the cloud and accessed in Workspace.

Applications can be created from scratch or from a QuickStart App. The applications that you create from scratch in Composer can consist of one or more of the following application components:

  • Processes are a sequence of tasks or activities that result in a well-defined outcome. Business Process Model and Notation (BPMN) elements within the process define the flow and behavior of the application.
  • Web Forms define the interface that your application users see in Workspace. You can create web forms from the ground up or you can base them on an existing data structure.
  • Business Types represent real-world concepts or objects, such as a ticket, a request, or an employee. You use business types to create the data structures that are required in your application.
  • Decisions are containers for if/then rules and decision tables that use the same input and output data objects. A decision exposes these data objects as a reusable service that multiple business processes can invoke.
  • Connectors define how a business process connects to other processes, systems, and REST and web services services.
  • Documents are organized and stored in Oracle Documents Cloud Service and used in Oracle Process Cloud Service.
  • Indicators are designated data objects used to capture business metrics for your process.

QuickStart Apps are ready-to-use applications with all the implementation details included for you to play, test, and deploy the application.

In this tutorial, you define decision and value sets that you will use to create the if/then and decision table business rules. The decision determines who approves submitted travel requests. You also assign the business rules to a process flow element in the Travel Request Process.

For a preview what you'll do, watch "Creating Business Rules."

Description of this image

What Do You Need?

Creating a Decision

In this topic, you create a decision that contains input and output data objects. You will use these data objects when you create the if/then and decision table business rules.

  1. In Composer, open the Travel Request Application, and ensure that you're in Edit mode.

    Application toolbar
    Description of this image
  2. On the Travel Request Application home page, click Decisions to display the New Decision dialog box.

    Travel Request Application home page
    Description of this image
  3. Click Create Decision.

    New Decision icon
    Description of this image
  4. In the Create Decision dialog box, enter ApprovalDecision for the name, and click Add Data Object.

    New Decision dialog box
    Description of this image
  5. In the Add Data Object dialog box, enter city for the name, leave Input as is, select string for the type, and click Add.

    Add Data Object dialog box
    Description of this image
  6. Click Add Data Object, enter purposeOfTravel for the name, leave Input as is, select string for the type, and click Add.

    Add Data Object dialog box
    Description of this image
  7. Repeat step 6 to add the following input and output, and then click Create.

    • Input: Enter travelAmount for the name, leave Input as is, and select double for the type.
    • Output: Enter supervisorReview for the name, select Output, and select boolean for the type.
    New Decision dialog box
    Description of this image

Creating a Value Set

In this topic, you define the allowed values for the input and output data objects that you just created.

  1. In the Business Rules Editor, click Value Sets.

    Business Rules Editor
    Description of this image
  2. In the left pane, select Add Value Set, and then select Value Set.

    Add Value Set drop-down list
    Description of this image
  3. On the Value Set page, enter CityValues for the name and press Enter. Click Add Value, enter "San Francisco" for the value, and press Tab.

    The Alias field is automatically populated with the Value entry. Every value set has an otherwise value, which you can't delete.

    Value Set page for CityValues
    Description of this image
  4. Repeat steps 2 and 3 to add a value set for PurposeOfTravelValues with a value of "Customer Visit".

    Value Set page for PurposeOfTravelValues
    Description of this image
  5. Repeat steps 2 and 3 to add a value set for SupervisorReviewValues, with a boolean data type. The values are automatically populated with true and false after you select the boolean data type.

    Value Set page for SupervisorReviewValues
    Description of this image
  6. In the left pane, select Add Value Set, and then select Range Value Set.

    Add Value Set drop-down list
    Description of this image
  7. On the Value Set page, enter TravelAmountValues for the name, press Enter, and select double for the data type. Click Add Value, enter 3000 for the end point and between 3000 and 5000 for the alias. Click Add Value, enter 5000 for the end point and deselect Included Endpoint twice.

    Every range value set has a -Infinity end point, which you can't delete.

    Range Value Set page for TravelAmountValues
    Description of this image
  8. In the Business Rules Editor, click Decision Properties.

    Decision Properties
    Description of this image
  9. On the Initial Actions toolbar, select Insert Action, and then select create.

    Initial Actions toolbar
    Description of this image
  10. Select ApprovalDecision.out from the Select a target list, and then click Edit properties.

    Initial Actions values
    Description of this image
  11. In the Properties dialog box, enter false for the value and click OK.

    Properties dialog box
    Description of this image

Creating an If/Then Rule

In this topic, you create an if/then rule. The rule specifies that, if an employee requests travel to San Francisco, then a supervisor must approve the travel request.

  1. In the Business Rules Editor, click Rules.

    Business Rules Editor
    Description of this image
  2. In the canvas, select General If/Then Rule.

    Rules Canvas
    Description of this image
  3. On the Rules page, click Properties, enter CityIf/Then for the name, and click OK.

    Rule Properties
    Description of this image
  4. On the IF toolbar, select simple test from the Advanced Add or Modify Options list.

    IF toolbar
    Description of this image
  5. Click Left Value.

    If toolbar with left value
    Description of this image
  6. In the Condition Browser dialog box, expand ApprovalDecision and in, select city to create the ApprovalDecision.in.city condition, and click OK.

    Condition Browser
    Description of this image
  7. Click Right Value.

    If toolbar with right value
    Description of this image
  8. In the Condition Browser dialog box, expand CityValues, select "San Francisco" to create the "San Francisco" condition, and click OK.

    Condition Browser
    Description of this image
  9. On the THEN toolbar, select modify from the Insert Action list.

    THEN toolbar
    Description of this image
  10. From the Select a target list, select ApprovalDecision.out, and click Edit properties.

    THEN statement values
    Description of this image
  11. In the Properties dialog box, enter true for the value and click OK.

    Properties dialog box
    Description of this image

    The completed if/then rule looks like this:

    Completed if/then rule
    Description of this image

Creating a Decision Table

In this topic, you create a decision table that determines whether a supervisor must approve a travel request. Approval is based on the purpose of travel, the travel amount, and the city.

  1. In the left pane, select Decision Table from the Advanced Add or Modify Options list.

    Left pane
    Description of this image
  2. On the Rules page, click Properties, enter PurposeOfTravelTable for the name, and click OK.

    Rule Properties
    Description of this image
  3. On the Decision Table toolbar, select Add Condition from the Add list.

    Decision table toolbar
    Description of this image
  4. In the Add/Modify Condition dialog box, expand ApprovalDecision and in, and select purposeOfTravel to create the ApprovalDecision.in.purposeOfTravel condition. By default, this condition uses the local range value set. Click Select or Edit Value Set to select the value set that you created for this condition.

    Add/Modify Condition dialog box
    Description of this image
  5. In the left pane, click PurposeOfTravelValues, and click Done.

    Add/Modify Condition dialog box
    Description of this image
  6. In the ApprovalDecision.in.purposeOfTravel row, click the R1 cell and select "Customer Visit" from the drop-down list.

    ApprovalDecision.in.purposeOfTravel rule value
    Description of this image
  7. On the Decision Table toolbar, select Add Condition from the Add list.

    Decision table toolbar
    Description of this image
  8. In the Add/Modify Condition dialog box, expand ApprovalDecision.in, and select travelAmount to create the ApprovalDecision.in.travelAmount condition. By default, this condition uses the local range value set. Click Select or Edit Value Set to select the value set that you created for this condition.

    Add/Modify Condition dialog box
    Description of this image
  9. In the left pane, click TravelAmountValues, and click Done.

    Add/Modify Condition dialog box
    Description of this image
  10. In the ApprovalDecision.in.travelAmount row, click the R1 cell and select between 3000 and 5000 from the drop-down list.

    ApprovalDecision.in.travelAmount rule value
    Description of this image
  11. Repeat steps 7 through 10 to add a condition for ApprovalDecision.in.city, with the CityValues value set, and set the R1 cell to otherwise.

    ApprovalDecision.in.city rule value
    Description of this image
  12. On the Decision Table toolbar, select Add Action - modify from the Add list.

    Decision table toolbar
    Description of this image
  13. In the Action Editor dialog box, select ApprovalDecision.out for the target, select Parameterized, and click OK.

    Action Editor dialog box
    Description of this image
  14. In the supervisorReview row, click the R1 cell and enter false for the value.

    Alternatively, you can browse and select false.

    supervisorReview rule value
    Description of this image
  15. On the Decision Table toolbar, select Add Rule from the Add list to create rule R2. Repeat these actions two more times to create rules R3 and R4.

    Decision table toolbar and rules R1 through R4
    Description of this image
  16. For the R2, R3, and R4 rules, select the following values for the specified conditions and actions:

    Condition or Action R2 R3 R4
    ApprovalRule.in.purposeOfTravel
    otherwise
    All
    All
    ApprovalRule.in.travelAmount
    between 3000 and 5000
    >5000
    <3,000
    ApprovalRule.in.city
    otherwise
    otherwise
    otherwise
    supervisorReview
    true
    true
    false

    The completed rows look like this:

    Completed Decision table
    Description of this image
  17. On the application toolbar, click Validate Application.

    portion of the Application toolbar with the Validate button highlighted
    Description of this image
  18. In the Validation pane, confirm that the Travel Request Application validated successfully.

    Validation pane
    Description of this image
  19. Save and close the ApprovalDecision decision.

Assigning a Decision to the Travel Request Process

In this topic, you assign the ApprovalDecision decision to the Travel Request Process.

  1. On the Travel Request Application home page, click Processes, and then click Travel Request Process.

    Travel Request Application home page
    Description of this image
  2. In the Travel Request Process, double-click the Amount > 5000 name, rename it Supervisor Review?

    Partial Travel Request Process
    Description of this image
  3. In the Elements Palette, click System. Drag and drop Decision onto the sequence flow above the Supervisor Review? gateway in the Manager swimlane.

    Travel Request Process with Component Palette
    Description of this image
  4. In the Travel Request Process, click Business rule task, click Menu, and select Open Properties.

    Decision element
    Description of this image
  5. Select ApprovalDecision for the decision.

    Implementation pane
    Description of this image
  6. In the Travel Request Process, click the Business rule task,  click Menu, and select Open Data Association.

    Partial Travel Request Process
    Description of this image
  7. In the Data Objects pane, on the Input tab, drag and drop travelRequestFormDataObject.form.city to the New Association field under Travel Request Process, and then put it in quotes to make it a string variable. In the Payload pane, drag and drop city to the field under Business rule task to complete the data association.

    Decision Data Associations
    Description of this image
  8. Repeat step 7 to create new data associations for the following:

    • Data object: "travelRequestFormDataObject.form.purposeOfTravel" to Payload: purposeOfTravel
    • Data object: travelRequestFormDataObject.form.travelAmount to Payload: travelAmount
    Decision Data Associations
    Description of this image
  9. In the Data Objects pane, on the Output tab, click Add New Data Object.

    Add New Data Object button
    Description of this image
  10. In the Add Data Object dialog box, enter supreviewOutcome for the name, select boolean for the type, and then click Add.

    New Process Data Object dialog box
    Description of this image
  11. In the Payload pane, drag and drop supreviewReview to the New Association field under Business rule task. In the Data Objects pane, drag and drop supreviewOutcome to the field under Travel Request Process, and click Apply.

    Decision Data Associations
    Description of this image
  12. In the Travel Request Process, click the sequence flow between Supervisor Review? and Review by Supervisor, and click Edit.

    Sequence flow from the Supervisor Review? gateway to the Review by Supervisor human task
    Description of this image
  13. In the Implementation pane, click Edit.

    Condition field in the Implementation pane
    Description of this image
  14. In the Expression Editor, delete travelRequestFormDataObject.form.travelAmount > 5000, enter supreviewOutcome==true, and click OK.

    Expression Editor over Implementation pane
    Description of this image
  15. On the application toolbar, click Save, and then click Publish.

    Save and Publish buttons
    Description of this image

Want to Learn More?