FIELD_INTEGRITY_EXCEPTION, You can’t change the completion date on a case milestone that’s already exited an entitlement process.: Completion Date: [CompletionDate]
Make sure the CaseMilestone is updated before the case is marked as closed.
If the Case is already in Closed status and if you have any processes to update the Milestone Completion Date, you will run into this error.
You can’t change the Completion Date on a Milestone that’s already exited an Entitlement Process.
For example, lets say I have an Entitlement Process built so that Cases exit that Entitlement Process when the Case Escalated check box is set to false and a Milestone is based on Escalated check box equals to true. If I have a Closed Case related to that Entitlement Process and that Case has exited the Entitlement Process(Escalated check box is set to false) and if I want to change the Completed Date on a Milestone on that Case, I can’t because the Case is not in the Entitlement Process. If I set the Escalated check box to true on the Case, then it would no longer meet the exit condition for the Entitlement Process. The Case goes back into that Entitlement Process, and it’s Milestones can be updated.
If the Exit Criteria is based on Status equal to Closed. Then, the Case Date/Time Closed and Entitlement Process End Time would be updated to the new Close Date. That in turn would affect calculations of the age of that case. (There may be additional considerations too).
SOQL to update CompletionDate:
SELECT Id, CompletionDate FROM CaseMilestone WHERE CaseId = '<Case Id>'