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

6.1. 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 in the upper-right corner click the Properties diagram properties icon.
  3. Input HardwareSpecReady in the Name field.
  4. Expand Implementation/Execution and select Adhoc Autostart.
  5. Expand Data Assignments, click diagram properties 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 Save.

6.2. 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 on to the canvas below the HardwareSpecReady milestone.
  2. Click the new milestone and in the upper-right corner click the Properties diagram properties icon.
  3. Input ManagerDecision in the Name field.
  4. Expand Implementation/Execution and select Adhoc Autostart.
  5. Expand Data Assignments and click diagram properties 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 Save.

6.3. 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 in the upper-right corner click the Properties diagram properties icon.
  3. Input Milestone1Orderplaced in the Name field.
  4. Expand Implementation/Execution and select Adhoc Autostart.
  5. Expand Data Assignments, click diagram properties 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 Save.
  7. Click Milestone1OrderPlaced and create a new script task.

    new task creation
    convert to a script task
  8. Click the new script task and in the upper-right corner click the Properties diagram properties icon.
  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 Milestone2OrderShipped.
  15. Click the down arrow in the Signal Scope field, select Process Instance.
  16. Click Save.

    Figure 6.1. OrderPlaced milestone

    Order placed milestone

6.4. 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 in the upper-right corner click the Properties diagram properties icon.
  3. Input Milestone2OrderShipped in the Name field.
  4. Expand Implementation/Execution and ensure that Adhoc Autostart is not selected.
  5. Expand Data Assignments, click diagram properties in the Assignments field, and add the following:

    OrderShippedReady 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 Save.
  7. Click Milestone2OrderPlaced and create a new script task.
  8. Click the new script task and in the upper-right corner click the Properties diagram properties icon.
  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 Milestone3DeliveredToCustomer.
  15. Click the down arrow in the Signal Scope field, select Process Instance.
  16. Click Save.

    Figure 6.2. OrderShipped milestone

    Order shipped milestone

6.5. 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 in the upper-right corner click the Properties diagram properties icon.
  3. Input Milestone3DeliveredToCustomer in the Name field.
  4. Expand Implementation/Execution and ensure that Adhoc Autostart is not selected.
  5. Expand Data Assignments, click diagram properties 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 Save.
  7. Click Milestone3DeliveredToCustomer and create a new user task.

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

      survey I/O values
    7. Click Save.
  8. Click the Customer satisfaction survey user task and create an end event.
  9. Click Save to confirm your changes.

    Figure 6.3. DeliveredToCustomer milestone

    DeliveredToCustomer 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.