# How do entitlement templates automate SLA assignment upon product sale or asset registration?

**Topic:** Service Cloud · **Difficulty:** Medium · **Tags:** Service Cloud, Entitlement Templates, Automation

Read it on the site: https://www.forcechallenges.com/interview-questions/how-do-entitlement-templates-automate-sla-assignment-upon-product-sale-or-asset-registration

## Answer

**Basics:** An Entitlement says what support a customer gets: account or asset, dates, business hours, entitlement process (SLA) and per-incident limits. An Entitlement Template stores those terms for a product so staff can apply them consistently. The original answer overstates this; templates themselves do not fire on a purchase. They also have historically been a Salesforce Classic feature; verify Lightning support in your release.

**How it works:** Setup > Entitlement Templates: define name, type, entitlement process, business hours, term, cases per entitlement. Add the template to Products. For automation, create a record-triggered flow or Apex trigger on Asset (or Opportunity Product / Order Product / Service Contract Line Item) that creates an Entitlement with AccountId, AssetId, SlaProcessId, BusinessHoursId, StartDate and EndDate. Then enable Entitlement Settings so cases automatically pick the matching entitlement (for example when the contact's account has one active entitlement).

**Advanced / deep dive:** Decide whether entitlements hang off Account, Asset or Service Contract. Asset-level entitlements enable product-specific SLAs; contract-level ones suit enterprise agreements. Use a custom mapping (Custom Metadata Type) from Product to Process so admins can change it without code. Consider renewals: extend EndDate or create a new entitlement rather than editing history. Case entitlement auto-population is the common failure point; when multiple entitlements are active, pick rules explicitly via flow or entitlement lookup filters.

**Code / config example:**
```apex
// Called from an after-insert Asset handler (bulk-safe)
public static void createEntitlements(List<Asset> assets, Id slaProcessId, Id bhId) {
    List<Entitlement> ents = new List<Entitlement>();
    for (Asset a : assets) {
        ents.add(new Entitlement(
            Name = 'Support - ' + a.Name, AccountId = a.AccountId, AssetId = a.Id,
            SlaProcessId = slaProcessId, BusinessHoursId = bhId,
            StartDate = Date.today(), EndDate = Date.today().addYears(1)));
    }
    insert ents;
}
```

**Hidden gotchas & must-remember points:**
- Templates do not auto-create entitlements.
- Entitlement needs StartDate and, to be active, a valid date range.
- SlaProcessId must reference an active entitlement process.
- Cases only get entitlements automatically if Entitlement Settings are enabled.
- Entitlement lookups on Case respect account and contact relationships.
- Workflow Rules and Process Builder are retired, so use Flow.

**Best practice:** Automate entitlement creation from the system of record for sales and test renewals and edge cases.

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