[SalesForce] Update Completion Dates of CaseMilestone

Using an Apex trigger to update the completion date field on case milestone related list when the case exited the entitlement process…I'm bringing that "Entitlement process End time" to fill in the completion date.

FIELD_INTEGRITY_EXCEPTION, You can’t change the completion date on a case milestone that’s already exited an entitlement process.: Completion Date: [CompletionDate]

Not using the entitlement process end time, how could i get the completion date value when the case exits the Entitlement process?

Also saw this Allow update/completion of Milestones via workflow

any pointers to get this task done either through workflow or Apex?

Best Answer

You need to make sure you update the CaseMilestone before the case saves as closed. The milestone must already be closed when the case is closed. Use a before update trigger on your case, and make sure that you update your completion date prior to closing the case. If your case is switching entitlement processes, this is more difficult, but you still do the same thing, before update, when the slaprocessid is changing, you close the open Milestone.

Related Topic