Find your content:

Search form

You are here

Closing Service Cloud Case Milestones using Apex

 
Share

I am having a look at Case milestones and entitlement processes that are part of the service cloud. I want to programmatically close one of the milestones after a certain Status value has been selected in the Case object, as suggested in the Entitlements Best Practice page.

Use Apex code to automatically mark milestones as Completed on cases that match unique criteria. For example, you can create an Apex trigger on EmailMessage that marks a first response milestone as Completed on cases when support reps send email from cases.

However, when I wrote a trigger to attempt this I found out that the IsCompleted field of the CaseMilestone object seems to be unwritable. (I checked in workbench as well and it has updateable : false for the IsCompleted field)

How would I close the milestone as suggested in the best practices docs?

Thanks


Attribution to: Joe

Possible Suggestion/Solution #1

You need to populate the CaseMilestone record's CompletionDate that will make the IsCompleted field true.


Attribution to: sorenkrabbe
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/1729

My Block Status

My Block Content