Ive been using the following example to complete milestones on Case Close which works fine when editing an existing Case.
However, this doesn't work when the rep creates a case and immediately marks it as closed as the Milestones do do exist at that point. I've tried using @future to execute the milestone logic after the case and milestones have been created, however, i then hit this error:
"You can’t change the completion date on a milestone that’s already exited an entitlement process.: Completion Date: [CompletionDate]”
Any suggestions on how to complete milestones when a Case is closed on insert?