Milestones
A milestone is used to represent achievable targets within the case. It is not associated with any work but rather marks that certain conditions have been reached within the case. As a milestone is a regular plan item definition, a milestone’s completion may be used as entry criteria for other tasks and stages. This way, a milestone can be used to bring logical stages within a case into order.
In XML, a milestone is defined as follows:
<milestone id="theMilestone" name="A Milestone"/>
When referenced in a case plan, a milestone gets completed as soon as its entry criteria are fulfilled. This requires no human interaction. A more complete example of a milestone depending on the completion of a human task is the following:
<definitions>
<case id="case" name="Case">
<casePlanModel id="CasePlanModel_1">
<planItem id="PlanItem_HumanTask" definitionRef="HumanTask_1"/>
<planItem id="PlanItem_Milestone" definitionRef="Milestone_1">
<entryCriterion sentryRef="Sentry_1" />
</planItem>
<sentry id="Sentry_1">
<planItemOnPart sourceRef="PlanItem_HumanTask">
<standardEvent>complete</standardEvent>
</planItemOnPart>
</sentry>
<humanTask id="HumanTask_1" />
<milestone id="Milestone_1" name="A Milestone" />
</casePlanModel>
</case>
</defintions>
In this case, the milestone will complete as soon as as the human task completes.
A milestone cannot have exit criteria.
Always define Milestones with Entry Criteria
A milestone without entry criteria is fulfilled as soon as the stage it is contained in becomes active. For example, a milestone item that is defined on the case definition level is completed as soon as the case is instantiated. It is therefore advisable to define at least one entry criterion for a milestone plan item.
Checking Milestones
In order to check whether a milestone has occurred, the history service can be used. The following checks the state of a milestone instance:
HistoricCaseActivityInstance milestoneInstance = historyService
.createHistoricCaseActivityInstanceQuery()
.caseInstanceId("aCaseInstanceId")
.caseActivityId("theMilestone")
.singleResult();
milestoneInstance.isCompleted(); // true if milestone occurred
Camunda Extensions
Extension Elements | camunda:caseExecutionListener |
---|