Friday, June 20, 2014

Configured Time Based Workflow for 5 mins or 10 or 15 etc... in salesforce

Salesforce supports only for hours and days time based workflows.But Some times we want to fire time based workflows for every 5 mins or 10 mins or 15mins etc..

I read @jdavidson909 article.This article will helpful for many developers to test time based workflow ,no need to wait for 1hr .simply  configure its to 5 mins and then developer can test easily .

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 3:00 pm, the value in Trigger Time 05 will be 2:05 pm.
The formula for 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

12 comments:

  1. why we cant subtract minutes from now() and these values 0.3800. I will be really thankful for any explanation on these values as I am not able to understand the meaning of 0.3800.

    ReplyDelete
  2. Excellent incredible blog layout! How long have you been blogging for? you make running a blog look easy. The overall glance of your website is magnificent, let alone the content!
    CRM Software in Dubai
    CRM Software in UAE
    CRM Software
    Best CRM Software
    Customer Relationship Management Software
    CRM Software for Small Business

    ReplyDelete