0

Can we make the "Case Milestones" target response time configurable ?

On the UAT, I am using values 30 mins, 1 hour etc, but on Production Environment it is expected to show the 5 business days, 7 business days etc. Now every time when the target time value changes I need to clone the entire milestone process. This is not good practice. Any guidance how we can do this? Specially when you have almost 50 entitlement processes and 200 Milestones ?

enter image description here

Edit-1: I am already using ApexClass to call some business logic, how I can used Apex class again ?

enter image description here

global class DateTimeCalculator implements Support.MilestoneTriggerTimeCalculator {  

    global Integer calculateMilestoneTriggerTime(String caseId, String milestoneTypeId){     
        Case c = [SELECT Id, CreatedDate FROM Case WHERE Id = :caseId];        
        MilestoneType mtype = [SELECT Name FROM MilestoneType WHERE Id = :milestoneTypeId];
        Integer i = 0;
        Date dt = date.newinstance(c.CreatedDate.year(), c.CreatedDate.month(), c.CreatedDate.day());

        if(mtype.Name != null){
            if (mtype.Name.equals('XXXXXXXXXXXXXXX')){
                List<MyService__c> mySerList = [SELECT Id,DateDeadline__c FROM MyService__c 
                              WHERE Case__c = :caseId 
                                AND DateDeadline__c != NULL];

                if(!mySerList.isEmpty()){
                    Date dDate = mySerList[0].DateDeadline__c;    
                    i = (dt.daysBetween(dDate))*24*60 ;     
                    return i; 
                }
            }
        }
        return i;
    }
}

EDIT-2 Ex: Entitlement Process X has assume 5 milestones.

  • Milestone-1 : Step1 to 20
  • Milestone-2 : Step4 to 18
  • Milestone-3 : step7 to 15
  • Milestone-4 : step 2 to 12 etc

These milestones are getting triggered based on the status and SubStatus values. The combination of the status & sub status value will be unique. The deadline of the SLA is dynamic. some of them are getting triggered based on the dynamic value population.

0

You can use Custom metadata types or Custom Settings to configure Milestones values.

Create an apex class which implements Support.MilestoneTriggerTimeCalculator interface and use calculateMilestoneTriggerTime method to calculate and return the milestone.

global class MilestoneTimeCalculator implements Support.MilestoneTriggerTimeCalculator 
{   

    global Integer calculateMilestoneTriggerTime(String caseId, String milest)      
    {
        for(Custom__mdt mdt: [SELECT Queue_Developer_Name__c, Queue_Name__c,SLA__c FROM Custom__mdt])
        {
            //check other proper conditions
            return Integer.valueof(mdt.SLA__c));
        }
    }
}

Finally, use this apex class in Milestones Details page. This way time change will be flexible.

6
  • I am already using APex class with the logic you shown in the above code for the other business logic. How can I used the another apex class again there ? Please guide – user46657 Aug 4 '17 at 18:42
  • yes, same class you will use, not need to create separate class – Santanu Boral Aug 4 '17 at 18:44
  • How SLA is driven by? Queue basis or Case Recordtype or any other conditions? Is that SLA is same for all the queues or owners? – Santanu Boral Aug 4 '17 at 19:23
  • Please see Edit-2. See SLA will be driver by RecordType, Category, SubCategory and it will be trigger at the case creation time. SLA will be same for each owner. But I have many SLA in a single process flows, some of them are recursive too. I am sure its not that simple. – user46657 Aug 5 '17 at 8:36
  • Create custom settings with Recordtype, Category, SubCategory and SLA with all possible combination and retrieve SLA based on those. – Santanu Boral Aug 5 '17 at 16:50

Your Answer

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