Automate Entitlement Insertion and Milestone Completion in Salesforce Lightning Experience

Anna Loughnan
8 min readMar 30, 2019

Despite the official Salesforce line, you CAN automate these Entitlement Management features using #ClicksnotCode!

Kia ora, this information originates from a May 2018 presentation to the Sydney Salesforce User Group. I had only ever worked with Salesforce’s Classic UI, so my presentation was using Classic. The following week I started a new role at a new company and went straight into working with the Lightning Experience UI (LEX). I then implemented the automated insertion of an entitlement to a case, and also automated the completion of milestones. In March 2019 I presented at the Admin Theatre at Sydney World Tour, and demonstrated in LEX how to achieve these two pieces of automation, using clicks not code.

Entitlement Limitation: every entitlement must be associated with an account

Salesforce documentation states that every entitlement must be associated with an account. So even in the situation where you have, say, standard Gold treatment for certain customers or products, each applicable customer needs their own individual entitlement created. And this means that automatically inserting an entitlement becomes problematic when a case is created, as the agent needs to search for the correct entitlement for that account before creating the case.

Milestone Limitation: Milestones aren’t marked as completed automatically

Many Service Cloud users wish to allow the automatic completion of a milestone based on conditions being met, for example, case status updated to Working, which in your org means that the customer has been contacted. This is a common question in the online forums. Note that Salesforce do provide a code solution for this, to be found in The Admin’s Guide to Entitlement Management. But there’s no standard config solution provided.

To resolve these two limitations, with #clicksnotcode automation, please follow the instructions below. Note that for the purposes of illustration, only Gold Service Level Entitlement with a single first touch milestone is discussed. This Milestone is defined as 60 minute first response to the customer, and this is indicated by the case status updated to Working.

Firstly, set up Entitlements and Milestones in LEX

Briefly detailed below are the steps required to set up Entitlements. You will need at least one Service Cloud license to achieve this, but not all staff will need this license type. Enable Entitlement Management in your org. This then exposes all the related objects and extra configuration options. I don’t discuss any milestone actions such as violation action etc.

Now you need to create a Milestone, noting that you will need to grab the id of this for a later step:

Now create your Gold Entitlement Process. Although you define here when the case exits the Entitlement Process (Status = Working), this doesn’t auto-complete the Entitlement’s Milestone for you! Note too that this Entitlement Process can be associated to any number of customer entitlements (we will use it with just one!)

Next step is to create a Milestone for this Entitlement Process, using the Gold First Response Milestone created earlier. This is now where you enter the criteria for this to apply. Your criteria should identify the characteristics of your defined ‘Gold’ entitlement. For example, Product ABC should always have Gold service, or Customer X. You may need to create custom fields on the Customer / Product objects to identify this. So a picklist would need Gold, Silver, Bronze, etc as options. (You will use these same criteria later to automatically apply this Entitlement Process.)

Now you need to create a generic account for each of your entitlement levels, eg: “Gold Service Entitlement ”.

And then it is against this generic account that you create the Entitlement. When it comes to automatically applying this entitlement, it can then be applied to any case, regardless of Case Account. You need to grab this specific Entitlement Id.

If you wish to confirm that the related Milestone is there as expected you will need to briefly switch to Classic as this related list hasn’t yet made it to LEX (as of Spring ‘19)

So now we have created a Milestone, Entitlement Process, and Entitlement for a generic Gold service level account. Now we need to automate the insertion of the Entitlement for any case that is created that meets our Gold service conditions. (For simplicity the illustrations below are based purely on Gold account designation and product designation isn’t examined).

Process Builder: You are only checking for a new case created, where it meets “Gold” definition. Insert the actual Entitlement Id into the Case Entitlement Id field (NB: note that the Id will be different in Production!)

That completes the automation for the auto-insertion of an Entitlement into a new case, based on your Gold service definition. This will save your agents much searching and eliminate the error of incorrect Entitlement association.

Autocomplete a Milestone

Where you can define consistently that a Milestone has been completed (in our example this is Status = Working), you don’t need to require the agent to still manually click the Mark Completed link on the Milestone, this is two agent actions, update status and mark milestone completed, taking extra effort and clicks.

This can be achieved in code, and Salesforce even provide the lines of code that that you can copy and paste, in The Admin’s Guide to Entitlement Management. It is not recognised officially that it is possible to achieve this through configuration.

This can be achieved using Process Builder, making sure your PB is not only firing on a new case. You need to include a check for an Entitlement Id as one of your conditions, as it is possible for the Entitlement to have been removed from the case despite the first part of the automation illustrated above. You are just checking that there is any Entitlement Id, as the PB will throw an error if this step is attempting to apply to a case without an Entitlement! The other conditions are based on your Gold service definition as well as the Milestone completion indication (status is now Working).

There is no specific checkbox etc to show that the Milestone has been completed, this is determined by date and time being entered into the Milestone’s Completion Date field. (The usual agent manual action of ‘Mark Completed’ does this). So we need to insert the current date and time into this Completion Date field to show it has been completed. The current date and time are found using the NOW() formula.

The Case Milestones object is related to the Case, and therefore you are able to achieve this in Process Builder through the Update Related Record action, making sure you are matching to the correct Milestone, this is where you insert the specific Milestone Id saved earlier as the condition. Note that it is called the Milestone Type Id on the Case Milestones object. Remember that this Id will be different in Production!

In terms of the automation, that’s it!

To get it properly set up in LEX, you will need to ensure that you display the Milestone component on the case page. This will be available as a standard component, as you have enabled Entitlements. Note that the Milestone related list hasn’t yet made it to LEX (as of Spring ‘19).

Now all that remains is to test this out! You will have already identified your ‘Gold’ customers by now, at the account level (or Products at the Product level, etc), with one or more picklists.

So go ahead and create a case for one of your Gold customers. As per the illustration below, as soon as you first save the new case, you should see the correct Milestone displayed and counting down. This means that the correct (generic) Gold account entitlement has been auto-applied.

Remember, for this example, our condition to auto-complete the Milestone is when the case status is updated to Working by the agent. And of course as this is LEX it is easy to do this with Path. As soon as Status is updated to Working, the Gold First Response has been marked as completed (and a subsequent Milestone is now active).

There you have it!

My recommendation is to carefully plan out the case lifecycle using milestones and statuses with Path guidance, and be consistent with your automation (eg automate all milestones OR status changes).

To summarise:

  • Create a generic but descriptive account for each specific entitlement (eg Gold, Silver, etc)
  • The entitlement you create for the generic account can then be auto-inserted via process builder into a case for any account, based on whatever conditions you set — this starts the milestone
  • Auto-complete the milestone when your exit conditions are met by inserting current date and time into the Case Milestone related record via process builder
  • Remember to edit the 2 process builder fields ids in Production
  • NO TRIGGER necessary!

Entitlements in Lightning Experience are still missing a few features, but as long as you are aware of them they aren’t significant and are not a barrier to using Entitlements in LEX. As of Spring ’19 there are still a few related lists unable to be exposed.

For detailed assistance with setting up Entitlements please refer to The Admin’s Guide to Entitlement Management. This is updated every Salesforce release and will detail any LEX limitations. Note that it doesn’t include my automation workarounds, but does include the Milestone Completion trigger code to copy and paste into your org.

You can get hands on in Trailhead — there is a special Entitlement Management badge. It is also part of the Trailhead super badge Service Cloud Specialist. The official Salesforce Advanced Administrator and Service Cloud Consultant certifications also include Entitlement Management questions.

--

--

Anna Loughnan

Salesforce MVP, Wellington, NZ. Application Architect, Mentor, Trailblazer, Salesforce Group Leader, Lightning Champion, traveller, Connector, 9x certified