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?

1 Answer 1


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.

  • thanks..i'm using the before update only but am i going in a correct approach to fill the completion date value with entitlement process end time? bcos it seems like end time is populated only when the case matched the criteria specified in e.process (in my scenario when case is closed), and if i query for the e.process endtime...it's already exited the case.
    – sam_s
    Feb 18, 2015 at 19:16
  • You can use System.now() and be within a few seconds. Salesforce has a published example code set for this on developerforce you should look at: developer.salesforce.com/…
    – JimRae
    Feb 18, 2015 at 19:20
  • Hey Jim, sorry for pinging you like this but I have another question on entitlement processes salesforce.stackexchange.com/questions/76430/…. and thought you might help me with this. Could you please take a look at it?
    – sam_s
    May 21, 2015 at 17:08
  • Please don't mind, I posted the answer myself for that question.
    – sam_s
    May 21, 2015 at 18:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .