Time Dependent Workflow for less than an hour

Workflow

Workflow is an automated process to implement the business logic, that evaluates the record at the time of creation or update. It is one of the most powerful tools of Salesforce.

Why necessary??

Workflow becomes indispensable to organizations for maximizing efficiency in their business processes. It allows tracking of processes.

Time dependent workflow has the following actions:-

1) New Email Alert.

2) New Field Update.

3) New Outbound message.

4) Select existing actions.

The “existing actions” again have the following actions:

a) Email Alert.

b) Field Update.

c) Outbound message.

 

Values such as days and hours only are supported by Salesforce for Time dependent workflows. The minimum value for them is 1. What if we get a requirement in which we need to send a mail just after 10 minutes or 20 minutes of a record creation? Well, Time based workflows have 1 hour as the minimum duration to fire the workflow. In this case we need to by-pass this limitation. For this we need to use a particular technique. This requires us to write a custom formula field that calculates Date/Time value. Let us create a formula field as Trigger Time 20.

This formula field actually saves  “Date/Time” value to your record which is 40 minutes in the past. If you save the record at 2:00 pm then the value in the “Trigger Time 20” will be 1:20 pm.

The formula for the Trigger Time 20 is:-

Trigger Time20 = (now () – 0.02764)

So now we need to create a time based workflow rule that fires 1 hour after Trigger Time 20. So 1 hour after a time which was 40 minutes ago, is 20 minutes from now.

This formula field will be accessible to all users but need not to be present in the layout.

Here is the chart which shows the values needed to be subtracted from now() function for each 5 minutes interval:-

Value in formula                                    Minutes ago                              will fire in (minutes)

0.04145                                                     60                                                  0

0.03800                                                    55                                                  5

0.03455                                                    50                                                  10

0.03109                                                    45                                                   15

0.02764                                                    40                                                  20

0.02418                                                    35                                                  25

0.02073                                                   30                                                   30

0.01727                                                    25                                                   35

0.01382                                                    20                                                  40

0.01036                                                    15                                                   45

0.00691                                                    10                                                   50

0.00345                                                    5                                                    55

0.00069                                                    1                                                    59

Profile photo of Rashi Krishna

Rashi Krishna

Salesforce developer at Mirketa Inc.
Posted in Agile, Learn Salesforce, Salesforce, salesforce Tips & Tricks. Tagged with , , , .

Leave a Reply

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


2 × = six

CommentLuv badge
Skip to toolbar