Sunday 2 November 2014

Salesforce Entitlement, Entitlement Process & Milestone Handling

Entitlement : 

Entitlements are the same as the normal objects we use in Salesforce like Account, Contacts etc.
Adding to it, its a child object to Case, Contracts etc.


Purpose of Entitlement in Salesforce is specifically for
  • Enforce service levels with time-dependent, automated processes that instruct agents how to resolve cases.
  • Defining Service levels.

Entitlement according to Salesforce-phere
Entitlement is driven by "Entitlement Process" Object (Look-up on Entitlement Object ) where we set "Milestones" and "Business Hours"

1. Milestones :- Milestones are actually automated time dependent workflow, which run on the time set by the user, in other words to automate the SLA, this is the key of whole Entitlement thing in Salesforce. You can define the actions in Milestone i.e. Field Update, Email Alerts same like normal workflow. 

2. Business Hours : It is used to define the limits of the Milestone Time that have been set by the user like working hours in which a case should be handled.

Enabling & Setting-up Entitlement

Go to Setup --> App Setup --> Customize --> Entitlement Management --> Entitlements

Click Check and Save

after saving you'll get this check according to your requirement and Save. Do check last check-box of Enable Milestone Feed Items, this will add milestone box in your feed item, where Milestone Status will be more visible to the users.


Now go to Entitlement Process create one Entitlement Process

Here is the Entitlement Process created


Above in the setup list there is Milestones, create one

Now create an Apex class, that will set the Trigger time for the milestone, create a custom Number field on Case named as "Milestone Time" and create this class which implements "Support.MilestoneTriggerTimeCalculator"


























Now whatever will be the value in the this field will be set as Time trigger of Case Milestone
We will use this class, while adding Milestone with an Entitlement Process.

Now return back to Entitlement that we have created earlier and and down to it click "new" button in Milestone section, and fill the values same as shown in below


We have done all the setup for the Entitlement Process and Milestone
Now we will create an Entitlement Record, (Don't get confused with Entitlement Process and Entitlement)

Entitlement Process

System object that have Milestones and is used while creating Entitlement (API name SLAProcess ) record.


Entitlement: 


Its an object, that will be associated with Case. It is as normal as other objects like Account, Contact. This is used to attach Case Milestone to the object.

We will create Entitlement record now, that we will attach to the case, search for the Entitlement Tab and click  new, create a new record as shown below, as marked below these field should be field to make Entitlement active otherwise you can't attache it to the Case as shown Status Icon it green check that means its active, you need to provide Start Date  for it, Entitlement process also need to be provided otherwise no Milestone Time will be on the Case, after saving entitlement record you can see the Milestone will be visible under the Milestone.


Now go the case, in the below snapshot, all those field which is used in Entitlement process are shown, we will create a new record of Case and in the Entitlement Name we will put the record that we have created above,
There is a Timeline field on Case layout,which show scale view of the Time that have been setup. Modify the layout and set Case Milestone related list as well

If user didn't close the case or whatever is the procedure to be done to close the case then case will be Violated that automated process, and then Milestone Status will be change.

Look we are done with Entitlement and Milestone thing of Salesforce
You can Milestone actions as well, go to the Entitlement process and Click on the related Milestone of it where you can action like Field Update and Emails alerts etc.

The biggest problem I faced with this functionality when I tried writing trigger on Case Milestone Violation, and attaching other Milestone with the Case. you can write on case on check of "Milestone Status" field that when the status changed to Open violation. but attaching other Milestone on the violation of the first one is not happening.

This is what I learned while working with Entitlement and Milestone of Salesforce.
Thank you, any queries will be appreciated, keep learning-keep coding.

Happy Coding!