+ Start a Discussion

SLA for each email received for case - not for case fields


I have a requirement where we have setup Email-to-Case setup. Our SLA is not based on stage of the case and not from start of the case to case closure. Instead, our SLA depends on time to reply for each email received for the case. 

For example, lets say, case has been created since an email is received, and lets say the SLA is 3 hours. then the clock to start once the case is created and should stop once the email is replied back. 

In case of 2 emails received on the same case, for ex., 9 AM and 11 AM, then the respective SLA is 12 noon & 1PM respectively. 

1. Is there any way to have dynamic multiple clocks based on number of emails not replied back? 

2. If the 1st point is not possible, is it possible to reset the clock once the 1st email is replied. For ex.,Until first email is replied,clock to show timer till 12 noon.  Once the first email is replied, the clock should start from the 2nd email received time and the clock to show the remaining time until 1PM. 

Is it possible or is there any way in salesforce where the SLA can be setup for each email received? Could you please advise if there is anye best way to achieve the solution.

Thanks a lot in advance. 
What I would do is to have a "ongoing response milestone" or something like that.  Have the milestone start the process on case creation and end when the case is closed.  Then write a trigger on the EmailMessage object (this gets created in email to case) that when a case is updated set the case's milestone's StartDate to Datetime.now().  Below is an example code that should get you going.
trigger UpdateCaseMilestone on EmailMessage (after insert) {
    Set<Id> caseIds = new Set<Id>();

    for (EmailMessage eml : Trigger.new) {


    if (!caseIds.isEmpty()) {
        List<CaseMilestone> milestones = [
            select StartDate
            from CaseMilestone
            where CaseId in :caseIds

        if (!milestones.isEmpty()) {
            for (CaseMilestone cm : milestones) {
                cm.StartDate = Datetime.now();

            update milestones;