Flow: How To Run a Scheduled Path WITHIN an Hour

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).

flow scheduled path - formula solution

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!

flow scheduled path

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.

Is This Helpful? Check Out Flow Use Cases Or Write Us One!

Official Salesforce Help Article On Flow

Subscribe
Notify of
guest

6 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Fernando Rodriguez

Why didn’t you use Zero as the value instead? Using zero would give the same outcome, no? I’ve used zero in past flows and it worked just fine for me.

Xop

Have you ever seen the function not calculate with a value using the Now()? I just utilized this formula and it worked in Salesforce Sandboxes but would not calculate a value from my Production environment. Is there any way to utilize a LastModifiedDate? Or do you have any thoughts on Now() not running and the field remaining blank with no datetime calculation?

In my sandbox the calculation and formula worked as expected, but it seems to never evaluate- I do not have it on a layout in Prod nor in the lower sandboxes…

Max

I can confirm the behaviour. The formula evaluates fine when doing SOQL in the developer console. But inside my flow it does not. I am sending an e-mail and do a decision and both times the formula does not evaluate…

Bill Macaulay

I thought this was very cleaver, but for me, even though the field is not in a page layout, the formula still updates, and triggers the flow multiple times.