I need the assistance on the below requirement.

Assume we've the 10 processes in a Single End-End process flow and let's say I want to keep the track of the process from step-2 to step-6 for the SLA / OLA. Assume at step-2 my request submitted and it goes through the no. approval process like Success and Reject, so I want to track this in time SLA, how much time it has taken to success. How we can do that ?

Assume it has same record or two different records (Salesforce system might have integration with other system). Can we track this information using the Entitlement Processes and Milestones ?

Can we calculate SLA between two processes ? Please guide what can be done ?

Note: Yes, it's related to Case object (it may be on other object but not sure though) and have different statuses etc., based on process steps and want to track how much time taken for each step.

What can be done if the case is violated ? Assume in 1st milestone is violated, then when the 2nd milestone could be initiated ?

  • Can you add more details with examples what you are trying to achieve – Santanu Boral Jul 17 '17 at 16:12
  • Reformatted my question now. – user46657 Jul 17 '17 at 16:18
  • 1
    Is that related to a Case object and you have different statuses based on process steps and you want to track how much time taken for each step. is that correct? – Santanu Boral Jul 17 '17 at 16:33
  • Right, updated in note section above. Will you please add some screen shots to support your answer ? – user46657 Jul 17 '17 at 16:40

This is tricky requirement but exactly I have achieved.


  1. Create Entitlement Process and define Miletones based on which Case will enter into the milestone. Milestone type will be Independent. You will define single Milestone for this process like Resolution Time.

  2. If you have a different SLA based on case types then you need to write code for proper SLA assignment. Let's say Support1 Team's SLA is 24hrs and Support2 team's SLA is 18 hours. So in that scenario, SLA should be dynamic. Use this apex class in Milestone configuration.


global class CaseMilestoneTimeCalculator implements Support.MilestoneTriggerTimeCalculator 
    public CaseMilestoneTimeCalculator(){  

    global Integer calculateMilestoneTriggerTime(String caseId, String milest)      
        //need to query the SLA defined in Custom setting/Meta data type for respective user or group
  1. Create a separate object say Resolution Tracker which will take the data from Milestone object. This tracker will have all the milestone data related to Case. Take all the fields from Milestone object to create this object and lookup to CaseId. And insert or update record based on case status changes.

  2. Since you have to complete one milestone when case status changes so, before starting a new milestone, update previous milestone with completed date.


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;


Resolution tracker



| improve this answer | |
  • you have to design based on the usecase, there could complex coding specially on Case trigger – Santanu Boral Jul 17 '17 at 17:22
  • you have to design, it could be complex, I have given the approach with screenshots. yes, customization is needed. – Santanu Boral Jul 17 '17 at 17:29
  • your question is too broad, so accept this question and ask a question taking a reference to this question – Santanu Boral Jul 18 '17 at 14:45

Your Answer

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