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 ?
Edit-1: I am already using ApexClass to call some business logic, how I can used Apex class again ?
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.