進行状況の追跡を始めよう
Trailhead のホーム
Trailhead のホーム

Set Up Milestones

Learning Objectives

After completing this unit, you’ll be able to:
  • Define required steps (milestones) for your support team to follow when resolving a customer case.
  • Create a timeline of milestones applicable to customer cases.
  • Set up automatic actions to notify your support team when a step needs to be completed.

Create a Milestone

Roberto, Ursa Major’s COO, decides to consult with Ada Balewa, product support specialist, to figure out Ursa Major’s customer support strategy. During their meeting, they outline Ursa Major’s new Happy Customer Policy: all high-priority cases must be closed within 16 business hours, and all medium- and low- priority cases must be closed within 32 business hours. They let Maria in on the plan, and she sets up an entitlement process (also known as a customizable timeline of support steps) that enforces the new policy.

First, Maria creates a "master" milestone that she can add to as many entitlement processes as she wants. Remember, milestones represent required steps in your support process.

  1. From Setup, enter Milestones in the Quick Find box, then select Milestones under Entitlement Management.

  2. Click New Milestone.

  3. Name your milestone Resolution Time, and enter a description so the support team knows what the milestone is tracking: The time given to resolve a customer’s issue. The countdown starts when the case is created and ends when the case Status is changed to Closed.

  4. For Recurrence Type, select No Recurrence. This means that the milestone only occurs once per case. Just so you know, there are two other possible recurrence types:

    1. Independent milestones occur whenever the milestone criteria are met on the case.
    2. Sequential milestones occur on repeat when the milestone criteria are met on the case.

  5. Click Save.

    Create a milestone.

Now any time Maria wants to see a list of master milestones for Ursa Major, she can enter Milestones in the Quick Find box, then select Milestones under Entitlement Management.

Create an Entitlement Process

Now that Maria has created a master milestone, it’s time for her to add it to an entitlement process. That’s where she adds the specifics, like case resolution time for high-priority cases. Maria creates an entitlement process that represents Ursa Major’s standard support terms.

Setting up an entitlement process.

  1. From Setup, enter Entitlement Processes in the Quick Find box, then select Entitlement Processes under Entitlement Management.

  2. Click New Entitlement Process.

  3. If you see the option to choose a Type, select Case.

  4. Name your process Standard Support, and enter the description: The default support process for customers.

  5. Don’t select Active. We activate the process after we add milestone actions to it.

  6. If you’d like, select a business hours option.  

    Tip: Business hours let you specify the hours when your support team is available to serve customers. If you don’t set any, your org defaults to 24/7 business hours.

  7. Leave the other fields as is, and click Save.

    Create an entitlement process.


Woohoo! Maria has set up Ursa Major’s Standard Support process, which she can apply to customers’ entitlements. However, her process doesn’t have any milestones. Not a problem! She can fix that by adding the master milestone she created.

Add a Milestone to an Entitlement Process

An entitlement process needs milestones to represent required support steps, otherwise it’s just an empty framework. Maria adds her Resolution Time milestone so agents know how much time they have to resolve cases according to Ursa Major’s standard support process. Let’s see how she does it.

  1. Navigate to the detail page of the Standard Support entitlement process you created. From Setup, enter Entitlement Processes in the Quick Find box and select Entitlement Processes. Then click Standard Support.

  2. Under Milestones, click New.

  3. For Milestone Name, choose the Resolution Time milestone you created at the beginning of this unit.

  4. Time Trigger (Minutes) is the number of minutes that agents have to complete the milestone—in other words, how long they have to resolve the case. Let’s revisit the terms of Ursa Major’s Happy Customer policy:

    • All high-priority cases must be closed within 16 business hours.
    • All medium- and low-priority cases must be closed within 32 business hours.

First, let’s tackle the high-priority case resolution limit. Enter 960 (that’s 16 hours x 60 minutes).

  1. Leave the Apex Class checkbox deselected. (This option lets you use Apex classes to calculate the time trigger dynamically. For now, let’s stick with the basics.)

  2. Leave the Start Time and Business Hours fields as is.

  3. For Order, enter 1.

  4. Leave the Criteria field as is, and select the criteria that must be met for the milestone to count down: Case: Priority equals High.

  5. Click Save.

    Add a milestone to an entitlement process.
  6. Now, let’s set up the same milestone for your medium- and low-priority cases.

    • Under Milestones, click New.
    • For Milestone Name, choose the Resolution Time milestone again.
    • Since medium- and low-priority cases must be closed within 32 hours, enter 1920 in the Time Trigger (Minutes) field.
    • Leave the Apex Class checkbox deselected.
    • Leave the Start Time and Business Hours fields as is.
    • For Order, enter 2.
    • Leave the Criteria field as is, and enter the criteria that must be met for the milestone to count down: Case: Priority equals Medium, Low.
    • Click Save.

Nicely done! Now Ursa Major’s entitlement process “knows” that high-priority cases must be resolved within 16 hours, and that medium- and low-priority cases must be resolved within 32 hours. Next, Maria adds a workflow action to notify agents when an open case is getting close to the resolution time limit.

Add a Milestone Action

Now that Maria has done a stellar job adding required steps to Ursa Major’s standard support process, she’s ready to do more. To keep agents in the know, she adds a milestone workflow action that warns agents when an open high-priority case is approaching the resolution time limit.

Create milestone actions.

  1. Navigate to the detail page of the Standard Support entitlement process you created. From Setup, enter Entitlement Processes in the Quick Find box and select Entitlement Processes. Then click Standard Support.

  2. Under Milestones, click the name of your milestone for high-priority cases.

  3. Under Warning Actions, click Add Time Trigger.

  4. Enter 2 and select Hours so agents are notified 2 hours before the Resolution Time milestone expires.

  5. Click Save.

  6. Under your new time trigger, click Add Workflow Action and select New Email Alert.

    Select New Email Alert.
  7. Enter a description: 2 hour warning before milestone expires.

  8. Use the Email Template lookup to select the Support: Case Response template.

  9. In the New Email Alert window, for Recipient Type, select Owner, then use the arrow button to add Case Owner as a selected recipient.

    Create a new email alert.
  10. Leave the remaining fields as is, and click Save. Now, case owners of high-priority cases receive a warning email 2 hours before the 16-hour resolution time limit is reached.

Maria celebrates her hard work—she’s in the home stretch!

Activate the Entitlement Process

Maria has set up an awesome entitlement process that reflects Ursa Major’s Happy Customer policy. Now it’s time for her to switch it on so she can apply it to customer entitlements.

  1. Navigate to the entitlement process.

    1. From Setup, enter Entitlement Processes in the Quick Find box, then select Entitlement Processes.
    2. Click the name of the process: Standard Support.

  2. Click Edit.

  3. Select Active, and click Save.

Apply the Entitlement Process to an Entitlement

Now that Maria’s entitlement process is ready for business, she can apply it to any customer entitlements she wants. This means that cases created from the entitlement follow the steps in that entitlement process. She starts by applying her entitlement process to the Standard Phone Support entitlement she created for DreamHouse Realty.

  1. In the App Launcher, type Entitlements in the search bar, then select Entitlements.

  2. Select the Standard Phone Support entitlement.

  3. Edit the entitlement. In the Entitlement Process field, use the lookup to select the Standard Support process.

    Alt text: Add an entitlement process to your entitlement.
  4. Click Save.

Create a Case Trigger for Entitlements

Without using an Apex trigger, entitlements aren’t automatically added to new cases. When a case’s Entitlement field is empty, this sample trigger checks whether the case contact has an active entitlement. If the contact has an active entitlement, the entitlement is added to the case. So Maria gets to work adding a basic trigger for cases.

  1. From the Object Manager, enter Case in the Quick Find box, then select Case.

  2. Select Triggers.

  3. Click New.

  4. Delete the blank trigger. Then copy and paste this code sample into the page:

    	trigger DefaultEntitlement on Case (Before Insert, Before Update) {
    	Set<Id> contactIds = new Set<Id>();
    	Set<Id> acctIds = new Set<Id>();
    	for (Case c : Trigger.new) {
    		contactIds.add(c.ContactId);
    		acctIds.add(c.AccountId);
    	}
        List <EntitlementContact> entlContacts =
                    [Select e.EntitlementId,e.ContactId,e.Entitlement.AssetId
                    From EntitlementContact e
                    Where e.ContactId in :contactIds
                    And e.Entitlement.EndDate >= Today
                    And e.Entitlement.StartDate <= Today];
    	if(entlContacts.isEmpty()==false){
    		for(Case c : Trigger.new){
    			if(c.EntitlementId == null && c.ContactId != null){
    				for(EntitlementContact ec:entlContacts){
    					if(ec.ContactId==c.ContactId){
    						c.EntitlementId = ec.EntitlementId;
    						if(c.AssetId==null && ec.Entitlement.AssetId!=null)
    							c.AssetId=ec.Entitlement.AssetId;
    						break;
    					}
    				}
    			}
    		}
    	} else{
    		List <Entitlement> entls = [Select e.StartDate, e.Id, e.EndDate,
    				e.AccountId, e.AssetId
    				From Entitlement e
    				Where e.AccountId in :acctIds And e.EndDate >= Today
    				And e.StartDate <= Today];
    		if(entls.isEmpty()==false){
    			for(Case c : Trigger.new){
    				if(c.EntitlementId == null && c.AccountId != null){
    					for(Entitlement e:entls){
    						if(e.AccountId==c.AccountId){
    							c.EntitlementId = e.Id;
    							if(c.AssetId==null && e.AssetId!=null)
    								c.AssetId=e.AssetId;
    							break;
    						}
    					}
    				}
    			}
    		}
    	}
    }
  5. Click Save.

Now, DreamHouse Realty’s cases automatically follow Ursa Major’s Standard Support process. That means Ursa Major’s support team sees the Resolution Time milestone counting down on the case.