I am in the process of assessing Entitlement Processes and CaseMilestones.
I have set up an Entitlement Process that has 2 CaseMilestones set up.
The first called Milestone 1 (Sequential) is initialized on when Case Status = New
(Technically when a case is created).
The second called Milestone 2 (Sequential) is initialized on setting the Case Status to a certain value ('Pending Confirmation').
Case enters the process:
Based on case created date
Case exits the process:
Closed EQUALS True
.
Now I have created a case and Milestone 1 has started and after 5 minutes it has been violated and I can see it in the related list as violated.
On the 6th minute, I change the status to 'Pending Confirmation'
and Milestone 1 disappears and Milestone 2 has started.
Once the case is closed
, Milestone 2(completed or violated) is also disappeared.
How can I make sure that they are displayed on the case related lists without disappearing even after the Milestones are completed or violated?
Best Answer
Salesforce doesn't close the previous active milestone automatically when you are changing the case status and creates a new milestone.
With the help of apex you need to search the active milestone (e.g.Milestone 1) of the Case and update the completion date in the CaseMilestone record.
Refer the below screenshot for understanding.
Please find the related code to complete the milestone. Refer Case Milestones Utility Class