# What role do Milestones play in measuring and enforcing Service Level Agreements (SLAs)?

**Topic:** Service Cloud · **Difficulty:** Medium · **Tags:** Service Cloud, Milestones, SLAs

Read it on the site: https://www.forcechallenges.com/interview-questions/what-role-do-milestones-play-in-measuring-and-enforcing-service-level-agreements-slas

## Answer

**Basics:** An SLA says what support you promise and how fast. In Salesforce, Entitlement Management models this: an Entitlement is attached to a case, an Entitlement Process defines the sequence of milestones, and each Milestone has a target time. Case Milestone records show whether each step is open, completed or violated.

**How it works:**
1. Enable Entitlement Management and define Milestones (Setup > Milestones) with a name and recurrence type.
2. Create an Entitlement Process (Type: Case or Work Order), set the start/exit/entry criteria, and business hours if applicable.
3. Add milestones to the process with a Time Trigger (minutes, hours or days), criteria for when the milestone applies, and actions.
4. Actions: Success actions (completed in time), Warning actions (time trigger before target), Violation actions (target passed).
5. Link the Entitlement to the process; when a case gets that entitlement, CaseMilestone records are created.
6. Complete the milestone when the condition happens (for example first outbound email) via Flow or Apex, or the agent clicks Complete in the milestone tracker.

**Advanced / deep dive:** Milestone clock start and stop depend on case status and the Pause conditions (Stop clock when status is On Hold, if configured by the process "Exit criteria" and business hours). Recurrence types: No recurrence, Independent (restarts per criteria), Sequential. Reporting uses CaseMilestone fields (TargetDate, IsViolated, IsCompleted, CompletionDate, ElapsedTimeInMins). Use a Flow on Case, or Apex, to set CaseMilestone.CompletionDate for automatic completion.

**Code / config example:** Complete open "First Response" milestones when an agent replies (bulk safe):
```apex
Set<Id> caseIds = new Set<Id>(); // collected from outbound EmailMessages
List<CaseMilestone> toClose = [
    SELECT Id FROM CaseMilestone
    WHERE CaseId IN :caseIds AND MilestoneType.Name = 'First Response'
      AND IsCompleted = false];
for (CaseMilestone cm : toClose) cm.CompletionDate = System.now();
update toClose;
```

**Hidden gotchas & must-remember points:**
- Milestones only run if the case has an Entitlement with a process; no entitlement, no clock.
- Actions use workflow-style action types (email alert, task, field update); this is separate from the Workflow Rule retirement, but verify availability in current release notes.
- Changing a process creates a new version; existing cases keep their old version.
- Case Milestone Tracker component must be added to the Lightning record page to be visible.
- Business-hours choice on the process vs. case matters for the countdown.
- Recurrence "Independent" can create many CaseMilestone rows per case.

**Best practice:** Automate milestone completion with Flow rather than relying on agents to click, and report on violations weekly.

---
Source: ForceChallenges · last updated 2026-11-02
