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
KD123456KD123456 

Time based workflow

Hi,

 

I have created a workflow on case object that would update a field based on the time trigger. The least time that I could setup was 1 hour. I would like to set it up such that it executes within 5 minutes and 1 hour. How do I get this done?

 

Thanks

KD

Best Answer chosen by Admin (Salesforce Developers) 
KD123456KD123456

Hi,

 

Thanks for your suggestion. I was able to find a work around in one of the forums. It talks about going round the problem by creating a datetime field in the object and set the time to be approximately the interval that you want and then set the time trigger of the workflow one hour from the time set for that field.

 

In my case I created the date time field and set a formula to fill it up (Now() - 0.038) this sets the time 55 minutes back from the current time. Then I created a Time trigger to do a field update 1 hour after the time in the custom field. Now the workflow will execute roughly within 5 minutes instead of 1 hour.

 

I found this workaround much easier to implement for my scenario.

 

Thanks

KD

All Answers

BA_AdminBA_Admin

You can set up the timedependent work flow only for hours or days, minutes functionality is still not added in workflows

EnthEnth

Also note that the time is approximate not explicit. You may schedule 1 hour but it could be well over an hour before it runs. (In practice it is usually within a few minutes of the specified time).

 

If you think in platform terms, the schedule time is simply a queue of actions for the underlying platform to process with the finite set of resources assigned. You'd get the same effect with a cron job on a Linux server if you had hundreds of entries scheduled for the same time.

KD123456KD123456

So is there any other way or workaround that can help me in scheduling the activity for running within few minutes of an action.

If workflow does not work is there any other custom option that can be developed for that.

EnthEnth

You can use Apex Scheduler to execute based on the minute, but again, this is the time it's added to the scheduled jobs queue and doesn't guarantee it will be executed on time. (The docs indicate you can specify the second but I'm positive this is ignored, there was a thread about it when it came out)

 

If you need to guarantee a specific time, then buy an Amazon EC2 instance and implement a script to perform a call on Salesforce that triggers your workflow (say update of a hidden field you use purely for this purpose). 

KD123456KD123456

Hi,

 

Thanks for your suggestion. I was able to find a work around in one of the forums. It talks about going round the problem by creating a datetime field in the object and set the time to be approximately the interval that you want and then set the time trigger of the workflow one hour from the time set for that field.

 

In my case I created the date time field and set a formula to fill it up (Now() - 0.038) this sets the time 55 minutes back from the current time. Then I created a Time trigger to do a field update 1 hour after the time in the custom field. Now the workflow will execute roughly within 5 minutes instead of 1 hour.

 

I found this workaround much easier to implement for my scenario.

 

Thanks

KD

This was selected as the best answer