function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Auto-Complete CaseMilestones on Case Create

Use Case:
When a user creates a case, an email response is delivered to a customer. This email should complete a "first response" milestone.

Technical Issue:
Trigger logic on the Case or EmailMessage objects cannot access CaseMilestones because they are created later asynchronously. I tried @Future calls, but CaseMilestone records still do not exist. A combo of Batch Apex Jobs scheduled from Triggers will successfully update CaseMilestones, but this is far from ideal.

Has anyone come across a solution to the need for immediate access to CaseMilestone records? (Some other use cases come to mind: Auto-complete "resolution" milestone if case is closed on create.)
ShashankShashank (Salesforce Developers) 
You should be able to update case milestones using the process builder:

Here are some triggger examples as well: