Chapter 4. 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.

Figure 4.1. orderhardware business process case definition

IT Orders case design

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 subprocesses, subcases, and business rules used in the case.

    1. In the upper-right corner, click the Diagram properties diagram properties icon.
    2. Scroll down and expand Case Management, click btn plus in the Case File Variables section, and enter the following:

      Figure 4.2. orderhardware case file variables

      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 Diagram properties diagram properties icon.
    2. Scroll down and expand Case Management, click btn plus in the Case Roles section, and enter the following:

      Figure 4.3. orderhardware case roles

      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.

4.1. Creating the Place order subprocess

Create the Place order subprocess, 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 Chapter 4, 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 Diagram properties diagram properties icon.
  6. Scroll down and expand Process Data and click btn plus in the Process Variables section and enter the following:

    proc vars
  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.

    start event
    new task
    user task
  9. Click the user task and in the Diagram 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 diagram properties in the Assignments field and add the following:

    place order io1

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

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

    Approved order #{CaseId} to be placed

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

    create end event
    sub proc
  15. Click Save to confirm your changes.

4.2. 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. 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.
    2. Click the new user task and in the upper-right corner click the Properties diagram properties icon.
    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 diagram properties in the Assignments field and add the following:

      Prepare hardware I/O values
    8. Click Save.
  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 in the upper-right corner click the Properties diagram properties icon.
    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 diagram properties in the Assignments field and add the following:

      Manager approval I/O values
    7. Click Save.
    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 subprocess:

    1. From the Object Library, expand Subprocesses, 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 subprocess.

      Creating a Data-based Exclusive (XOR) gateway to subprocess
    3. Click the new sub task and in the upper-right corner click the Properties diagram properties icon.
    4. Input Place order in the Name field.
    5. Expand Data Assignments and click diagram properties in the Assignments field and add the following:

      Place order I/O values
    6. Click the connection from the Data-based Exclusive (XOR) gateway to the subprocess and click the Properties diagram properties icon.
    7. Expand Implementation/Execution, select Condition, and set the following condition expressions.

      Sequence flow conditions
    8. 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 in the upper-right corner click the Properties diagram properties icon.
    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 diagram properties in the Assignments field and add the following:

      Order rejected I/O values
    8. Click Save.
    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.

    Figure 4.4. Manager approval business process

    Manager approval business process