Today I want to share a solution that is one of my favorites, yet a very simple one. If you ever work with time-dependent actions in Workflow, scheduled actions in Process Builder, and scheduled paths in Flow, you must have noticed that the minimum time unit is an hour. But sometimes even one hour is TOO LONG! As a result, it can be difficult for admins to troubleshoot the new flow and for users to remember whether they’ve finished the actions or not.
But don’t worry. Let’s resolve this situation with a formula field on the target object!
The Concept of Setting Desired Delay
The concept involves very easy math. Since, at minimum, the tools can only push the delay one hour or more, we can create a formula date/time field and set it to 1 hour + X minutes from now. Then in the flow, we can set the schedule to be 1 hour before the formula field. This means the schedule will fire at the X minutes mark (equation: (1 hour + X minutes) – 1 hour). X here is your desired delay in minutes.
Take the graph below, for example. If we want to fire the scheduled path after only 5 minutes, we need to create a field that is 1 hour and 5 minutes from now (and later, we’ll subtract that hour).
Transform the Concept Into a Formula Field
The second step is to transform this calculation into a formula. First, we need to create a formula field with Date/Time type as Date type will only return the same day.
Then we’ll translate the 1 hour + X minutes from now into formula syntax. To start, we’ll need to define the “Now” time using the Now() function.
Caution: It’s important to note that when you perform addition or subtraction with the Date or Date/Time fields, the unit is always “Days”. So, using “+ 1” in your formula means you’re adding one day. To get hours, we must divide 1 by 24. To get minutes, divide 1 by 1440 (24 x 60). The formula that follows is our goal – 1 hour + 5 minutes from now (again, we’ll subtract one hour later).
Be Extra Careful When Setting the Schedule Time
All set with the field! Now we just need to reference this field in the schedule path and substract one hour. Pay close attention to the Offset Options to avoid any surprises (ex. If we mistakenly choose Hours After (as opposed to Hours Before), it will run 2 hours 5 minutes later, not the intended 5 minutes).
Bonus note! Besides Flow, This method works on Workflow and Process Builder too!
Do Not Put The Formula Field On The Object Page Layout
The formula field is calculated whenever the field is viewed or referenced. If you put it on the page layout, the system will update the field again and again whenever users edit the record. As a result, the scheduled actions will be postponed. This is undesirable as we only want the field to calculate whenever we run the flow.
To avoid this, my suggestion is first to have it on the page layout just so you can confirm the formula is correct, and then remove it so no one sees it.
The Actions Might Not Run At The Exact Moment
Even though we can schedule the actions to run sooner, the actual execution still depends on your system’s capacity. If there are many scheduled actions or jobs running at the same time, you might experience some delays. However, it should still be very close.