2

I've setup an entitlement process with milestones (no-reoccurrence type) & entitlement, and assigned the entitlement to a case.

The process is working great, but once a milestone is complete it disappears from the Case Milestones related list.

My purpose is to collect statistical data about the milestones, where I need the ActualElapsedTime fields, which according to the answer I got here, those fields are only populated by Salesforce after completion, but my issue is that at this point the milestone disappears from the CaseMilestone object table, so I cannot collect this data.

I've tried settings the milestone type to independent, but it did not change anything. I've also tried to apply Business Hours to the entitlement, thinking it must be present for the calculation to work, but still nothing.

Is there a way to prevent this? Some configuration that I'm missing? Unfortunately, Salesforce docs regarding the milestone functionality are not the best to say the least...

2

Scenario 1:

It might be possible that, the existing milestone is not closed (which is disappearing) before completion and one new milestone is getting created before closing the earlier milestone.

May be the milestones are getting created based on case status changes.

If you close (explicitly, through some coding or process builder) the previous milestone and then create a new milestone then all the milestones will be displayed in CaseMilestones related list.

Scenario 2:

It might be possible that, one existing milestone is running and case is getting closed without closing the milestone. In this scenario also, the milestone will be vanished from CaseMilestones related list.

Same workaround, update the milestone with completed = true and completion datetime and then close the case.

Here is the code to complete milestone:

public class MilestoneUtils 
{
    public static void completeMilestone(List<Id> caseIds, DateTime complDate) 
    {

        List<CaseMilestone> cmsToUpdate = [select Id, completionDate
                                            from CaseMilestone cm
                                            where caseId in :caseIds and IsCompleted =False
                                            and completionDate = null limit 1];
            if (cmsToUpdate.isEmpty() == false)
            {
                for (CaseMilestone cm : cmsToUpdate)
                {
                    cm.completionDate = complDate;
                }
                update cmsToUpdate;
            }
    }
}
4
  • Great! Thank you! If only SF would add some information about those cases in their docs :/ – Ron Dadon Oct 24 '18 at 10:18
  • 1
    Thats why we are here in SFSE – Santanu Boral Oct 24 '18 at 10:24
  • @santanu boral after completion of milestone,is it possible to update case ? – Annappa Apr 11 '19 at 10:09
  • Yes that is possible – Santanu Boral Apr 12 '19 at 3:28

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.