0

Hi I am using sequential milestone in our project.

We also have initial response and resolution time milestones working on case. Sequential milestone we used to send an update to the customer between specified time. so when we send first update it gets stopped and reschedule again. It works perfectly.

The problem is when case is closed at that time resolution time milestone is get stopped but update(sequential) milestone still running. It doesn't make any sense to send the update when case is closed

Could anyone provide me the solution how to stop this sequential milestone completely after closing the case??

  • whats the criteria you have specified for sequential milestone firing – Santanu Boral Feb 15 '18 at 17:12
1

I faced this issue earlier. Generally, you can close the Milestones by a trigger that automatically marks milestones Completed on cases that match unique criteria. But in case of Sequential Milestone, it will create another Milestone as soon as you close one. To resolve this, I removed the Entitlement from the Case as soon as it closes. It worked for me.

Examples as mentioned in the Salesforce Help Article. The change I made is c.EntitlementId = null;

Trigger

trigger CompleteResolutionTimeMilestone on Case (before update) {
    if (UserInfo.getUserType() == 'Standard'){
        DateTime completionDate = System.now(); 
        List<Id> updateCases = new List<Id>();
        for (Case c : Trigger.new){
            if (((c.isClosed == true)||(c.Status == 'Closed'))&&((c.SlaStartDate <= completionDate)&&(c.SlaExitDate == null))){
                updateCases.add(c.Id);
                c.EntitlementId = null;
            }
        }
        if (updateCases.isEmpty() == false){
            milestoneUtils.completeMilestone(updateCases, 'Every 10 Minute Response', completionDate);
        }
    }
}

Util Class

public class MilestoneUtils {
    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;
        }
    }
}
| improve this answer | |
  • Thanks for your reply. I have used your logic. I have removed entitlement when case status is updated to closed. I have done it through trigger and it works for me. Thanks a lot !!!!! – Jagdish Feb 16 '18 at 6:23
  • Actually i was facing one issue while using above solution. when entitlement is removed that cases not comes under the respective entitlement. so what i did i remove the entitlement process (not entitlement) through trigger and in next line of code i again assigned that process to case. Due to this the milestone get completed and still showing for respective case and due to reassignment milestone are starting when new case is created for same entitlement. – Jagdish Feb 23 '18 at 14:08
0

Code is not needed to accomplish this. All you need to check is that Status is not Closed in the Milestone Criteria on the Entitlement Process.

| improve this answer | |

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.