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 Hardware spec ready 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 left arrows to open the Properties panel.
  3. Input Hardware spec ready in the Name field.
  4. Select true from the Adhoc autostart menu.
  5. Click the down arrow in the Assignments field and add the following new conditions in the Hardware spec ready Data I/O window.

    Add CaseData(data.get("hwSpec") != null) by selecting Constant from the Source menu.

    Hardware spec ready I/O values
  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 the canvas below the Notify requestor script task.
  2. Click the new milestone and in the upper-right corner, click left arrows to open the Properties panel.
  3. Input Manager decision in the Name field.
  4. Select true from the Adhoc autostart menu.
  5. Click the down arrow in the Assignments field and add the following new conditions in the Manager decision Data I/O window.

    Add CaseData(data.get("managerDecision") != null) by selecting Constant from the Source menu.

    Manager decision I/O values
  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, click the default Milestone object.
  2. In the upper-right corner, click left arrows to open the Properties panel.
  3. Input Milestone 1: Order placed in the Name field.
  4. Select true from the Adhoc autostart menu.
  5. Click the down arrow in the Assignments field to add a new condition in the Milestone 1: Order placed Data I/O window.
  6. 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.

    Milestone evaluation condition configuration
  7. Click Save.
  8. Click Milestone 1: Order placed and create a new script task.

    new task creation
    convert to a script task
  9. Click the new script task and in the upper-right corner, click left arrows to open the Properties panel.
  10. Input Notify requestor in the Name field.
  11. Click the down arrow in the Script field, input System.out.println("Notification::Order placed");, and click Ok.
  12. Click the Notify requestor scipt task and create a signal end event.

    new end event
    convert to a signal event
  13. Click the signal event and click left arrows to open the Properties panel.
  14. Click the down arrow in the Signal Scope field, select Process Instance.
  15. Click the down arrow in the SignalRef field, input Milestone 2: Order shipped, and click Ok.

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 left arrows to open the Properties panel.
  3. Input Milestone 2: Order shipped in the Name field.
  4. Select false from the Adhoc autostart menu.
  5. Click the down arrow in the Assignments field to add a new condition in the Data Inputs and Assignments window.
  6. 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.
  7. Click Save.
  8. Click Milestone 2: Order shipped and create a new script task.
  9. Click the new script task and in the upper-right corner, click left arrows to open the Properties panel.
  10. Input Send to tracking system in the Name field.
  11. Click the down arrow in the Script field, input System.out.println("Order added to tracking system");, and click Ok.
  12. Click the Send to tracking system scipt task and create a signal end event.
  13. Click the signal event and click left arrows to open the Properties panel.
  14. Click the down arrow in the Signal Scope field, select Process Instance.
  15. Click the down arrow in the SignalRef field, input Milestone 3: Delivered to customer, and click Ok.

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 left arrows to open the Properties panel.
  3. Input Milestone 3: Delivered to customer in the Name field.
  4. Select false from the Adhoc autostart menu.
  5. Click the down arrow in the Assignments field to add a new condition in the Milestone 3: Delivered to customer window.
  6. 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.
  7. Click Save.
  8. Click Milestone 3: Delivered to customer and create a new user task.
  9. Click the new user task and in the upper-right corner, click left arrows to open the Properties panel.
  10. Input owner in the Actors field.
  11. Input Customer satisfaction survey in the Name field.
  12. Input CustomerSurvey in the Task Name field.
  13. Click the down arrow in the Assignments field to add data input and output assignments in the Milestone 3: Delivered to customer Data I/O window as shown below. For the output Data Type column, select Constant, and input Survey [com.myspace.it_orders_new]. Click Save.

    survey I/O values
  14. Click the Customer satisfaction survey user task and create an end event.
  15. Click Save, and then Save to confirm your changes.

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.

For more information about ad hoc processes, see Chapter 8, Ad hoc and dynamic tasks.