As a business rules and processes developer, you can use case management assets in Business Central to create unpredictable and ad hoc case processes. Case workers or process administrators can also use Business Central for case management and execution. IBM Business Automation Manager Open Editions provides example projects with example business assets in Business Central as a reference. This document describes how to create and test an example IT orders project based on the IT_Orders sample project included in Business Central.

Prerequisites

Reviewing the IT_Orders sample project

Before you create your own case management project, review the existing IT_Orders sample case management project in Business Central. This sample project contains predefined case management assets as a reference for your own case projects.

Procedure
  1. In Business Central, go to MenuDesignProjects. If there are existing projects, you can access the samples by clicking the MySpace default space and selecting Try Samples from the Add Project drop-down menu. If there are no existing projects, click Try samples.

  2. Select IT_Orders and click Ok.

The Assets view of the project opens. Select each example asset to explore how the project is designed to achieve the specified goal or workflow.

Review the orderhardware business process to help you understand the business process flow.

orderhardware Business Processes (legacy) asset

Creating a new IT_Orders case project

Create a new IT_Orders project in Business Central to gain an understanding of all of the required assets and how they are used in the project.

Procedure
  1. Log in to Business Central and go to MenuDesignProjects.

    Business Central provides a default space called MySpace. You can use the default space to create and test example projects.

  2. Click the Add Project drop-down arrow and select the Case project option:

  3. In the Add Project window, enter IT_Orders_New in the Name field and enter a project Description.

  4. Click Add to add the project.

    The Assets view of the project opens.

Data objects

Data objects are the building blocks for the rule assets that you create. Data objects are custom data types implemented as Java objects in specified packages of your project. For example, you might create a Person object with data fields Name, Address, and DateOfBirth to specify personal details for loan application rules. These custom data types determine what data your assets and your decision services are based on.

Creating the ITOrderService data object

The ITOrderService data object specifies the data type that will be used to define the IT Orders variables.

Prerequisites
  • The IT_Orders_New project is created.

Procedure
  1. Click Add AssetData Object.

  2. In the Create new Data Object wizard, enter the following values:

    • Data Object: ITOrderService

    • Package: com.myspace.it_orders_new

  3. Click OK.

  4. Click the plus sign icon next to the Package drop-down menu to specify a new package for the data object.

  5. Input org.jbpm.demo.it_orders.services and click Add.

  6. Click Save, and then click Yes, Move to confirm your changes.

Creating the Survey data object

The Survey data object contains data fields, such as deliveredOnTime and missingEquipment. You will use the data and values when you design your case.

Prerequisites
  • The IT_Orders_New project is created.

Procedure
  1. In Business Central, go to MenuDesignProjects and click IT_Orders_New.

  2. Click Add AssetData Object.

  3. In the Create new Data Object wizard, enter the following values:

    • Data Object: Survey

    • Package: com.myspace.it_orders_new

  4. Click OK.

  5. Add the Survey data object constraints.

    1. Click add field.

    2. Enter the following values:

      • Id: comment

      • Label: Leave empty

      • Type: String

    3. Click Create and continue, and then enter the following values:

      • Id: deliveredOnTime

      • Label: Leave empty

      • Type: Boolean

    4. Click Create and continue, and then enter the following values:

      • Id: missingEquipment

      • Label: Leave empty

      • Type: String

    5. Click Create and continue, and then enter the following values:

      • Id: satisfied

      • Label: Leave empty

      • Type: Boolean

    6. Click Create.

  6. Click Save to confirm your changes.

    screen capture of the survey data objects dialog
    Figure 1. Survey data object details

Designing the case definition

You design cases using the process designer in Business Central. Case design is the basis of case management and sets the specific goals and tasks for each case. The case flow can be modified dynamically during run time by adding dynamic tasks or processes. In this procedure, you will create this same case definition to familiarize yourself with the case definition design process.

The IT_Orders sample project in Business Central includes the following orderhardware business process case definition.

IT Orders case design
Figure 2. orderhardware business process case definition
Prerequisites
Procedure
  1. In Business Central, go to MenuDesignProjects and click IT_Orders_New.

  2. Click Add AssetCase Definition.

  3. In the Create new Case definition window, add the following required information:

    • Case Definition: Input orderhardware. This is usually the subject of the case or project that is being case managed.

    • Package: Select com.myspace.it_orders_new to specify the location that the case file is created in.

  4. Click OK to open the process designer.

  5. Define values for the case file variables that are accessible to the sub-processes, subcases, and business rules used in the case.

    1. In the upper-right corner, click the Properties diagram properties icon.

    2. Scroll down and expand Case Management, click the plus sign icon in the Case File Variables section, and enter the following:

      Case file variables
      Figure 3. orderhardware case file variables
    Note

    The following case file variables are custom data types:

    • hwSpec: org.jbpm.document.Document (type in this value)

    • survey: Survey [com.myspace.it_orders_new] (select this value)

  6. Click Save.

  7. Define the roles involved in the case.

    1. In the upper-right corner, click the Properties diagram properties icon.

    2. Scroll down and expand Case Management, click the plus sign icon in the Case Roles section, and enter the following:

      Case roles
      Figure 4. orderhardware case roles
      • owner: The employee who is making the hardware order request. The role cardinality is set to 1, which means that only one person or group can be assigned to this role.

      • manager: The employee’s manager; the person who will approve or deny the requested hardware. The role cardinality is set to 1, which means that only one person or group can be assigned to this role.

      • supplier: The available suppliers of IT hardware in the system. The role cardinality is set to 2, which means that more than one supplier can be assigned to this role.

  8. Click Save.

Creating the Place order sub-process

Create the Place order sub-process, which is a separate business process that is carried out by the supplier. This is a reusable process that occurs during the course of case execution as described in Designing the case definition.

Prerequisites
Procedure
  1. In Business Central, go to MenuDesignProjectsIT_Orders_New.

  2. From the project menu, click Add AssetBusiness Process.

  3. In the Create new Business Process wizard, enter the following values:

    • Business Process: place-order

    • Package: Select com.myspace.it_orders_new

  4. Click OK. The diagram editor opens.

  5. Click an empty space in the canvas, and in the upper-right corner, click the Properties diagram properties icon.

  6. Scroll down, expand Process Data, click the plus sign icon in the Process Variables section, and enter the following values under Process Variables:

    Table 1. Process variables
    Name Data Type

    CaseID

    String

    Requestor

    String

    _hwSpec

    org.jbm.doc

    ordered_

    Boolean

    info_

    String

    caseFile_hwSpec

    org.jbm.doc

    caseFile-ordered

    Boolean

    caseFile-orderinf

    String

    screen capture of the process variables list
    Figure 5. Completed process variables
  7. Click Save.

  8. Drag a start event onto the canvas and create an outgoing connection from the start event to a task and convert the new task to a user task.

    screen capture of Create Task icon
    screen capture of Convert into User icon
  9. Click the user task and in the Properties panel, input Place order in the Name field.

  10. Expand Implementation/Execution, click Add below the Groups menu, click SelectNew, and input supplier.

  11. click the Properties icon in the Assignments field and add the following data inputs and outputs in the Place order Data I/O dialog box:

    Table 2. Data inputs and assignements
    Name Data Type Source

    _hwSpec

    org.jbpm.document

    caseFile_hwSpec

    orderNumber

    String

    CaseId

    Requestor

    String

    Requestor

    Table 3. Data outputs and assignements
    Name Data Type Target

    ordered_

    Boolean

    caseFile_ordered

    info_

    String

    CaseFile_orderInfo

    screen capture of the Place order Data I/0 dialog

    For the first input assignment, select Custom for the Data Type and input org.jbpm.document.Document.

  12. Click OK.

  13. Select the Skippable check box and enter the following text in the Description field:

    Approved order #{CaseId} to be placed

  14. Create an outgoing connection from the Place order user task and connect it to an end event.

    screen capture of the Place order user task
    screen capture of the end event added to the Place order user task
  15. Click Save to confirm your changes.

You can open the sub-process in a new editor in Business Central by clicking the Place order task in the main process and then clicking the Open Sub-process task icon.

screen capture of the Open Sub-process icon

Creating the Manager approval business process

The manager approval process determines whether or not the order will be placed or rejected.

Procedure
  1. In Business Central, go to MenuDesignProjectsIT_Orders_Neworderhardware Business Processes.

  2. Create and configure the Prepare hardware spec user task:

    1. Expand Tasks in the Object Library and drag a user task onto the canvas and convert the new task to a user task.

    2. Click the new user task and click the Properties diagram properties icon in the upper-right corner.

    3. Input Prepare hardware spec in the Name field.

    4. Expand Implementation/Execution, click Add below the Groups menu, click SelectNew, and input supplier.

    5. Input PrepareHardwareSpec in the Task Name field.

    6. Select the Skippable check box and enter the following text in the Description field:

      Prepare hardware specification for #{initiator} (order number #{CaseId})

    7. click the Properties icon in the Assignments field and add the following:

      Prepare hardware I/O values
    8. Click OK.

  3. Create and configure the manager approval user task:

    1. Click the Prepare hardware spec user task and create a new user task.

    2. Click the new user task and click the Properties diagram properties icon in the upper-right corner.

    3. Click the user task and in the Properties panel input Manager approval in the Name field.

    4. Expand Implementation/Execution, click Add below the Actors menu, click SelectNew, and input manager.

    5. Input ManagerApproval in the Task Name field.

    6. click the Properties icon in the Assignments field and add the following:

      Manager approval I/O values
    7. Click OK.

    8. Select the Skippable check box and enter the following text in the Description field:

      Approval request for new hardware for #{initiator} (order number #{CaseId})

    9. Enter the following Java expression in the On Exit Action field:

      kcontext.setVariable("caseFile_managerDecision", approved);

    10. Click Save.

  4. Click the Manager approval user task and create a Data-based Exclusive (XOR) gateway.

    Creating a gateway
    Creating a Data-based Exclusive (XOR) gateway
  5. Create and configure the Place order reusable sub-process:

    1. From the Object Library, expand sub-processes, click Reusable, and drag the new element to the canvas on the right side of the Data-based Exclusive (XOR) gateway.

      Creating a reusable task
    2. Connect the Data-based Exclusive (XOR) gateway to the sub-process.

      Creating a Data-based Exclusive (XOR) gateway to sub-process
    3. Click the new sub task and click the Properties diagram properties icon in the upper-right corner.

    4. Input Place order in the Name field.

    5. Expand Data Assignments and click the Properties icon in the Assignments field and add the following:

      Place order I/O values
    6. Click OK.

    7. Click the connection from the Data-based Exclusive (XOR) gateway to the sub-process and click the Properties diagram properties icon.

    8. Expand Implementation/Execution, select Condition, and set the following condition expressions.

      Sequence flow conditions
    9. Click the Place order user task and create an end event.

  6. Create and configure the order rejected user task:

    1. Click the Data-based Exclusive (XOR) gateway and create a new user task.

    2. Drag the new task to align it below the Place order task.

      Align new task
    3. Click the new user task and click the Properties diagram properties icon in the upper-right corner.

    4. Input Order rejected in the Name field.

    5. Expand Implementation/Execution and input OrderRejected in the Task Name field.

    6. Click Add below the Actors menu, click SelectNew, and input owner.

    7. click the Properties icon in the Assignments field and add the following:

      Order rejected I/O values
    8. Click OK.

    9. Select the Skippable check box and enter the following text in the Description field:

      Order #{CaseId} has been rejected by manager

    10. Click the Order rejected user task and create an end event.

    11. Click Save.

  7. Click the connection from the Data-based Exclusive (XOR) gateway to the Order rejected user task and click the Properties diagram properties icon.

  8. Expand Implementation/Execution, select Condition, and set the following condition expressions.

    Sequence flow conditions
  9. Click Save.

    Manager approval business process
    Figure 6. Manager approval business process

Milestones

Milestones are a special service task that can be configured in the case definition designer by adding the milestone node to the process designer palette. When creating a new case definition, a milestone configured as AdHoc Autostart is included on the design palette by default. Newly created milestones are not set to AdHoc Autostart by default.

Case management milestones generally occur at the end of a stage, but they can also be the result of achieving other milestones. A milestone always requires a condition to be defined in order to track progress. Milestones react to case file data when data is added to a case. A milestone represents a single point of achievement within the case instance. It can be used to flag certain events, which can be useful for Key Performance Indicator (KPI) tracking or identifying the tasks that are still to be completed.

Milestones can be in any of the following states during case execution:

  • Active: The condition has been defined on the milestone but it has not been met.

  • Completed: The milestone condition has been met, the milestone has been achieved, and the case can proceed to the next task.

  • Terminated: The milestone is no longer a part of the case process and is no longer required.

While a milestone is available or completed it can be triggered manually by a signal or automatically if AdHoc Autostart is configured when a case instance starts. Milestones can be triggered as many times as required, however, it is directly achieved when the condition is met.

Creating the Hardware spec ready milestone

Create a HardwareSpecReady milestone that is reached when the required hardware specification document is completed.

Procedure
  1. In the process designer, expand Milestone in the Object Library and drag a new milestone on the canvas and place it on the right side of the Place order end event.

  2. Click the new milestone and click the Properties diagram properties icon in the upper-right corner.

  3. Input Hardware spec ready in the Name field.

  4. Expand Implementation/Execution and select AdHoc Autostart.

  5. Expand Data Assignments, click the Properties icon in the Assignments field, and add the following:

    HardwareSpecReady I/O values

    Click the Source column drop-down, select Constant, and input org.kie.api.runtime.process.CaseData(data.get("hwSpec") != null).

  6. Click OK.

Creating the Manager decision milestone

This milestone is reached when the managerDecision variable has been given a response.

Procedure
  1. In the process designer, expand Milestone in the Object Library and drag a new milestone onto the canvas below the HardwareSpecReady milestone.

  2. Click the new milestone and click the Properties diagram properties icon in the upper-right corner.

  3. Input Manager decision in the Name field.

  4. Expand Implementation/Execution and select AdHoc Autostart.

  5. Expand Data Assignments and click the Properties icon in the Assignments field and add the following:

    ManagerDecision I/O values

    Click the Source column drop-down, select Constant, and input org.kie.api.runtime.process.CaseData(data.get("managerDecision") != null).

  6. Click OK.

Creating the Order placed milestone

This milestone is reached when the ordered variable, which is part of the Place order sub-process, has been given a response.

Procedure
  1. In the process designer, expand Milestone in the Object Library and drag a new milestone on the canvas below the Prepare hardware spec user task.

  2. Click the new milestone and click the Properties diagram properties icon in the upper-right corner.

  3. Input Milestone 1: Order placed in the Name field.

  4. Expand Implementation/Execution and select AdHoc Autostart.

  5. Expand Data Assignments, click the Properties icon in the Assignments field, and add the following:

    Milestone evaluation condition configuration

    Click the Source column drop-down, select Constant, and input org.kie.api.runtime.process.CaseData(data.get("ordered") == true). This means that a case variable named ordered exists with the value true.

  6. Click OK.

  7. Click Milestone 1: Order placed and create a new script task.

  8. Click the new script task and click the Properties diagram properties icon in the upper-right corner.

  9. Input Notify requestor in the Name field.

  10. Expand Implementation/Execution and input System.out.println("Notification::Order placed");.

  11. Click the Notify requestor script task and create a signal end event.

  12. Click the signal event and in the upper-right corner click the Properties. diagram properties icon.

  13. Expand Implementation/Execution, click the down arrow in the Signal field, and select New.

  14. Input Milestone 2: Order shipped.

  15. Click the down arrow in the Signal Scope field, select Process Instance.

  16. Click Save.

    Order placed milestone
    Figure 7. Order placed milestone

Creating the Order shipped milestone

The condition for this milestone is that a case file variable named shipped is true. AdHoc Autostart is not enabled for this milestone. Instead, it is triggered by a signal event when the order is ready to be sent.

Procedure
  1. In the process designer, expand Milestone in the Object Library and drag a new milestone on the canvas below the Notify requestor script task.

  2. Click the new milestone and click the Properties diagram properties icon in the upper-right corner.

  3. Input Milestone 2: Order shipped in the Name field.

  4. Expand Implementation/Execution and ensure that AdHoc Autostart is not selected.

  5. Expand Data Assignments, click the Properties icon in the Assignments field, and add the following:

    Order shipped ready I/O values

    Click the Source column drop-down, select Constant, and input org.kie.api.runtime.process.CaseData(data.get("shipped") == true). This means that a case variable named shipped exists with the value true.

  6. Click OK.

  7. Click Milestone 2: Order shipped and create a new script task.

  8. Click the new script task and click the Properties diagram properties icon in the upper-right corner.

  9. Input Send to tracking system in the Name field.

  10. Expand Implementation/Execution and input System.out.println("Order added to tracking system");.

  11. Click the Send to tracking system script task and create a signal end event.

  12. Click the signal event and in the upper-right corner click the Properties. diagram properties icon.

  13. Expand Implementation/Execution, click the down arrow in the Signal field, and select New.

  14. Input Milestone 3: Delivered to customer.

  15. Click the down arrow in the Signal Scope field, select Process Instance.

  16. Click Save.

    Order shipped milestone
    Figure 8. Order shipped milestone

Creating the Delivered to customer milestone

The condition for this milestone is that a case file variable named delivered is true. AdHoc Autostart is not enabled for this milestone. Instead, it is triggered by a signal event after the order has successfully shipped to the customer.

Procedure
  1. In the process designer, expand Milestone in the Object Library and drag a new milestone on the canvas below the Send to tracking system script task.

  2. Click the new milestone and click the Properties diagram properties icon in the upper-right corner.

  3. Input Milestone 3: Delivered to customer in the Name field.

  4. Expand Implementation/Execution and ensure that AdHoc Autostart is not selected.

  5. Expand Data Assignments, click the Properties icon in the Assignments field, and add the following:

    Delivered to customer I/O values

    Click the Source column drop-down, select Constant, and input org.kie.api.runtime.process.CaseData(data.get("delivered") == true). This means that a case variable named delivered exists with the value true.

  6. Click OK.

  7. Click Milestone 3: Delivered to customer and create a new user task.

    1. Click the new user task and click the Properties diagram properties icon in the upper-right corner.

    2. Input Customer satisfaction survey in the Name field.

    3. Expand Implementation/Execution, click Add below the Actors menu, click SelectNew, and input owner.

    4. Input CustomerSurvey in the Task Name field.

    5. Select the Skippable check box and enter the following text in the in the Description field:

      Satisfaction survey for order #{CaseId}

    6. click the Properties icon in the Assignments field and add the following:

      survey I/O values
    7. Click OK.

  8. Click the Customer satisfaction survey user task and create an end event.

  9. Click Save to confirm your changes.

    Delivered to customer milestone
    Figure 9. Delivered to customer milestone

The IT Orders case can be closed after all milestone sequences are completed. However, due to the ad hoc nature of cases, the case could be reopened if, for example, the order was never received by the customer or the item is faulty. Tasks can be re-triggered or added to the case definition as required, even during run time.

Deploying and testing the IT order case project

After you create and define all components of the new IT_Orders_New case project, deploy and test the new project.

Prerequisites
Procedure
  1. In Business Central, go to MenuDesignProjects and click IT_Orders_New.

  2. Click Deploy.

  3. Go to MenuManageProcess DefinitionsManage Process InstancesNew Process Instance.

  4. Go to MenuDeploy and click Execution Servers and verify that a new container is deployed and started.

  5. Use the Case Management Showcase application to start a new case instance. For instructions about using the Showcase application, see Using the Showcase application for case management.

Additional resources