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
Jos VervoornJos Vervoorn 

Case field update after milestone processing

Seeking a way to update case field after milestone processing. We have tried several options like flow with process builder, apex trigger (with/without @Future annotation) but ... whatever we try .... case field is not updated.

To sketch the scenario:
On the case, we would like to have a field to contain the deadline for the active milestone. So when we complete the current milestone ... this custom field get's populated with the deadline.

Now we can do this whenever a field update on the case has been performed ... but it seems that milestone processing takes place after triggers and after process builder. I have seen some samples out there but  ... I'm having a hard time to get this working while it sounds so easy.

 - milestone is completed / case deadline is populated by next milestone

All help & support is much appreciated.
Dave.RiesDave.Ries
Hey Jos!
I just started working with Milestones, and in building out my requirements, I ran in to the exact same issue you described here.  I can't seem to update the parent Case when the Milestone is changed.

In my particular situation, I'm simply trying to push the Target Date up to a field on the parent Case when the Milestone is created.

Did you happen to find a solution to the problem?

(If anyone else is reading this, and wondering why you'd want to do such a thing... it's because I'd like to display the Target Date in Case List views).
Dave.RiesDave.Ries
Actually... it looks like I may have been able to solve my issue.  I'm not sure if it helps you (5 months late).

The problem I was having, stems from the fact that whatever Salesforce is doing to create/edit/update the Milestone records, that functionaly comes after Triggers/Process Builder etc execute.

If I were writing a Trigger to push the data up to Case, it looks like I could do this with an @Future method, which delays the update until after all the Milestone changes have been made:
http://blog.deadlypenguin.com/blog/2015/07/29/service-breach-time-displaying-it-on-the-case/

But I try to avoid code if there is a declarative solution.  So in my situation, I've created a Process Builder that runs when an "Entitlement" is added to a Case.  It then does a Scheduled Action "0 Hours after LastModified Date" (which mimics @Future).  The Scheduled Action runs a Flow, which picks the Milestone record with the latest Target Date, and updates the Case with that value.

It ain't pretty... but it works.
Jos Vervoorn 2Jos Vervoorn 2
Thanks, Dave for your feedback. Much appreciated. I guess where you implemented the solution using Process Builder it's using a flow. Can you elaborate some more on the flow you have used here? I'm curious because we have several milestones (3). So within each (active), I would like to update the case. There's also no clear way to figure out which milestone is the first as initially, we have a response and they all start at case creation. So I have 3 'Not completed' milestones and I would like to have the first to populate the case target datetime field
Laura GilLaura Gil
Hi Dave, it would be interesting to know how you solved this with a flow ;). I was in communicatin with the Salesforce Support and indeed this combination of PB with Milestones + Field Update is a known issue. We are also stuck here as our customer wants unconditionally custom notifications and not email notifications.