The 5 Minute Time-Based Salesforce Workflow

Salesforce provides two types of workflows  – Immediate and time-based workflows.  Time-based workflows are evaluated at the time interval you set – some number of hours or days after or before another date or time field on the record. But you can’t set any time increment less than an hour… or can you?

TIP
Whenever possible, automate your if/then statements with Process Builder instead of workflow rules.

Many times we are facing that we need to create a time-based workflow that will fire after an hour, few or a day. For that we need to test if that workflow is working and to do that we need to find a way to test it in a shorter time period.

For example – our Sales Reps may make several changes to an Opportunity over the course of 15 minutes, but I don’t want to send workflow update emails after every change.  But it is important that the Sales Manager is notified as soon as possible.  So I’d like to send a workflow email 20 minutes after the last change.

Therefore we need to find a way to trick the platform to do what we want.

5 Minute Time-Based Workflow Steps

First, on the object that you need the workflow on, create a new custom formula field that evaluates to a Date/Time value.  I called my field Trigger Time 05, meaning that it’s a time trigger that I use to fire a workflow in 5 minutes.

What Trigger Time 05 actually does is saves a Date / Time value to your record that is 55 minutes in the past.  If you save your record at 4:00 pm, the value in Trigger Time 05 will be 3:05 pm.

Trigger Time 05 =

Now() – 0.038

Then, you write a Time Based Workflow rule that fires 1 hour after Trigger Time 05.  So, one hour after a time 55 minutes ago… is 5 minutes from now!

If you have multiple time intervals you need workflows to fire at, you’ll need to create multiple Trigger Time formula fields, like Trigger Time 05, Trigger Time 15, Trigger Time 30, etc.

I have found that the time intervals that the workflow rules aren’t exactly five minutes, but they are pretty close.

As with many of the other custom formula fields I’ve mentioned on this blog, you’ll want to make this field accessible to all users, but don’t put it on any page layouts.

Here’s a chart that shows the value you’ll need to subtract from Now() for each 5 minute interval.

Value in Formula

Minutes Ago

Will Fire In

 0.04145

60

Minutes

0

Minutes

 0.03800

55

Minutes

5

Minutes

 0.03455

50

Minutes

10

Minutes

 0.03109

45

Minutes

15

Minutes

 0.02764

40

Minutes

20

Minutes

 0.02418

35

Minutes

25

Minutes

 0.02073

30

Minutes

30

Minutes

 0.01727

25

Minutes

35

Minutes

 0.01382

20

Minutes

40

Minutes

 0.01036

15

Minutes

45

Minutes

 0.00691

10

Minutes

50

Minutes

 0.00345

5

Minutes

55

Minutes

 0.00069

1

Minute

59

Minutes

 

Educate Yourself Further

Read more about How To: Use Images In ‘Formula’ Fields
Check out this Trail: Advanced Formulas

Share this article...

Salesforce Mentor, with 10 years Salesforce experience, Hardcore Admin & Guru Developer, Geek, Animal lover, and dog & cat rescuer activist. Lifetime student, Stand-Up comedian wannabe, Photographer, Gamer, Anime lover, and coffee addict. Spreading Salesforce love and teaching beyond my capacity. Aiming to become Tech Architect!

2 Comments

  1. Eleanor Bockley Reply

    I had to implement a 10 minute email alert. Seemed to work great and when I checked the list of time based workflows the scheduled date/time was 10 minutes later. Unfortunately SF didn’t send it until 20 minutes later. If it was only off by a minute I could deal but 10 minutes won’t work.

Leave a Reply

Your email address will not be published. Required fields are marked *