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
Laura GilLaura Gil 

Looking for a way to reproduce the Case Milestone target Date in a formula field on the Case object

Hi all,

I am in some way confused about how to write a formula reproducing the field Target Date field (object Case Milestone) in a custom field in the Case object.

I don't know if someone has worked with Milestones and knows what I am talking about.

Case Milestones Fields:

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_casemilestone.htm

I am thinking about a formula like this for example for our First Response Milestone:
 
CreatedDate + MilestonesTimeTrigger - TIME OUTSIDE BUSINESS HOURS x MilestonesTimeTrigger

Where:
CreatedDate: Daytime when the case was created
MilestonesTimeTrigger: Within every milestone you have to set after how many minutes, hours or days the SLA will expire
TIME OUTSIDE BUSINESS HOURS: Say, your company has as business hours 8am - 5pm. The rest of the daytime won't be used for calculation of when teh target date is, that means 15 hours
The Target Date in a Milestone is given this way e.g. '05.02.2021, 11:56'.

I am wondering if there is a possibility to reproduce the target date in a formula field on the Case so this custom field is displayed in the way it is in the Case Milestone.

Any tips will be appreciated.
ShirishaShirisha (Salesforce Developers) 
Hi Laura,

Greetings!

Please find the approach suggested here (https://trailblazers.salesforce.com/answers?id=90630000000hdawAAA).

1. Create a custom field on Case EX: 'Milestone_Target_Date_Time__c'.
2. Create a TimeTrigger on CaseMilestone.
3. Add a FieldUpdate to Update Case.

As soon as Milestone is created, makesure your Timetrigger update the Milestone's TargetDate on Case custon Field.

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
Vila Shah 16Vila Shah 16
Hi Shirisha,
I do not see Milestone's target date which I can use to update case custom field