2

I am working on the OOTB Milestones and now looking to calculate the Sum of the Elapse Time.

  1. How we can calculate the sum of all these Elapse Times using formula fields? Do I need to write some other logic ? As we all know we can not edit/update the CaseMilestones fields.
  2. In some cases, I only need to get the overall(End-to-End SLA) Elapse Time. So in this, I have to used Category & sub category value to differentiate from the another SLA's. How can I only get the 1st SLA elapse time ? Do I need to show Total Elapse time when all milestones are completed, right ?

enter image description here

How we can get the Elaspse Time of all Milestone attached to that case using SOQL ? Any guidance around this ?

1 Answer 1

1

You can do this upon executing following SOQL

SELECT SUM(ElapsedTimeInMins) 
From CaseMilestone 
WHERE CaseId = '<case id>' 
and IsCompleted = true

Refer CaseMilestone Object definition

Update

You could limit your query to display the first record milestone record. You could also add case attributes (Category and Sub Category) in the filter.

SELECT CaseId, Case.Category__c,
    CompletionDate,
    CreatedDate,
    ElapsedTimeInMins,Id,
    IsCompleted,
    IsDeleted,
    IsViolated,
    MilestoneTypeId,
    MilestoneType.Name, 
    StartDate 
FROM CaseMilestone  
WHERE CaseId='<case id>' AND IsCompleted=true 
AND Case.Category__c = '<my category>' LIMIT 1
6
  • The context of SLA handling is not clear from the question Aug 9, 2017 at 19:13
  • find my updated answer to get the 1st SLA Aug 10, 2017 at 15:18
  • Thanks, My Category & SubCategory is on the Case Object. How we can get that at the CaseMilestone query ? Aug 10, 2017 at 15:37
  • sure !, please upvote the question too ! Aug 10, 2017 at 16:46
  • 1
    you can put Order BY CreatedDate, so the first one you will get Aug 15, 2017 at 18:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .