function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shoshinsha81Shoshinsha81 

time based

How to create a trigger to send email alert after 30 minutes? 
Best Answer chosen by Shoshinsha81
Mahesh DMahesh D
Salesforce workflows come in 2 flavors – real time and time-based workflows.  Time-based workflows are evaluated at the time interval you set – some number of hours or days after another date or time field on the record. But you can’t set any time increment less than an hour… or can you?
But I’m an impatient guy.  Sometimes, I don’t want a workflow to fire right now, but I can’t wait an hour.  There may be some business processes that need to be completed in 5 minutes, or half an hour.
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.

Or, like in my Dynamic Reports object (described on this blog), I have implemented a function that allows a user to edit a value in an editable list view, refresh their screen and run a report.  Five minutes after they run that report, I want to wipe out the value they used, so that other users can use this function.
I’ll admit that I found this tip someplace out here on the WWW, but I can’t recall exactly where. So if it’s your idea I’m borrowing, thank you!
To create a workflow rule that fires in less than one hour, you have to trick Salesforce.
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.


-------------------------------------------------------

Copy paste the above URL into the browser address bar and you will get the above information.

I solution is to create a formula field and use it in the time dependent workflow to send an email.

Regards,
Mahesh
 

All Answers

Mahesh DMahesh D
Hi June,

For this kind of requirements, better to use Time Based Workflow.

Regards,
Mahesh
Shoshinsha81Shoshinsha81
30 Minutes is not an option for timebased workflow. Thanks
 
Mahesh DMahesh D
Please look into the below link:

https://sftipshack.wordpress.com/2013/10/21/the-5-minute-time-based-workflow-or-15-minute-or-30-minute/

Regards,
Mahesh
Shoshinsha81Shoshinsha81
Not able to access the link. Can you please post the actual trigger. Thanks
Mahesh DMahesh D
Salesforce workflows come in 2 flavors – real time and time-based workflows.  Time-based workflows are evaluated at the time interval you set – some number of hours or days after another date or time field on the record. But you can’t set any time increment less than an hour… or can you?
But I’m an impatient guy.  Sometimes, I don’t want a workflow to fire right now, but I can’t wait an hour.  There may be some business processes that need to be completed in 5 minutes, or half an hour.
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.

Or, like in my Dynamic Reports object (described on this blog), I have implemented a function that allows a user to edit a value in an editable list view, refresh their screen and run a report.  Five minutes after they run that report, I want to wipe out the value they used, so that other users can use this function.
I’ll admit that I found this tip someplace out here on the WWW, but I can’t recall exactly where. So if it’s your idea I’m borrowing, thank you!
To create a workflow rule that fires in less than one hour, you have to trick Salesforce.
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.


-------------------------------------------------------

Copy paste the above URL into the browser address bar and you will get the above information.

I solution is to create a formula field and use it in the time dependent workflow to send an email.

Regards,
Mahesh
 
This was selected as the best answer
Shoshinsha81Shoshinsha81
Thanks
Mahesh DMahesh D
Hi June,

It is helps, please mark it as solved so that it will be helpful for others,

Regards,
Mahesh
Shoshinsha81Shoshinsha81
Sure let me review it first sir. Thanks again