Prominent limitation of time based workflow for batch processing


I was going through the following link about time based workflows. My aim was to avoid governor limits encountered for a class implementing Apex Schedulable interface. For a while time based workflow seems to be an alternative. 

Time based workflow queues its tasks. If the tasks are above the limit, it executes the left over tasks in the current run in the next hourly run. But, the following limitation may make the time based workflow unpredictable.

Time-dependent actions aren't executed independently. They're processed several times every hour, where they're grouped together and executed as a single batch. Therefore, any triggers that fire as a result of those grouped actions are also executed in a single batch. This behavior can cause you to exceed your Apex governor limits if you design your time-based workflow in conjunction with Apex triggers.

Finally, Salesforce will run all the queued jobs as a batch job on an hourly basis. Below is another blog post on the same issue.


At this point in time Schedulable interface appears to be better than time based workflow. We can use Limits Apex method to gracefully exit the batch job. As promised in the above blog if time based workflow is made to run for every 5 minutes, it may have edge over Schedulable interface. 

Comments

Popular posts from this blog

Updating SourceData/ Data Source of the Pivot Table

Salesforce.com migration tool - Deploying Weblink and migrating files with special characters

Information Architecture - Setup your term store to scale