3

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?

3

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.

Case with Milestones

Please find the related code to complete the milestone. Refer Case Milestones Utility Class

public static void completeMilestone(List<Id> caseIds, String milestoneName, DateTime complDate) {

    List<CaseMilestone> cmsToUpdate = [select Id, completionDate
                       from CaseMilestone cm
                       where caseId in :caseIds and cm.MilestoneType.Name=:milestoneName and completionDate = null limit 1];
    if (cmsToUpdate.isEmpty() == false){
      for (CaseMilestone cm : cmsToUpdate){
        cm.completionDate = complDate;
      }
      update cmsToUpdate;
    } // end if
  }
2
  • glad it helped you. :) – Santanu Boral Jan 9 '17 at 20:17
  • I have the same issue. How does apex help with the disappearing of milestones? I did not get that part – Jan Tonnet Feb 6 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.