Filed under: Administration February 17, 2010

This is just a quick note on Time-Dependent Workflows.

Time-Dependent Workflow is not like a typical scheduler. For example, it does not work like this:

  1. Enter the criteria that will trigger Workflow Action(s)
  2. Select the date and time for the trigger
  3. On the date and time, read every record and evaluate the criteria on each one
  4. For those that meet the criteria, perform the Workflow Action(s)

It does work like this:

  1. The Workflow Rule Criteria are evaluated immediately upon saving a record.
  2. Workflow Actions (for example, Email Alerts) are scheduled if the record meets the Rule Criteria.  The system does not wait until the date and time to evaluate the criteria.
  3. The scheduled Workflow Actions are cancelled if the record is updated in a way that no longer meets the Workflow Rule Criteria.

Additional Notes:

  1. It might seem that the Email Alert is not created until the Time Trigger date, but in reality, the Email Alert is put into a queue immediately as if it needs to go out and then canceled if it no longer needs to go out.
  2. This approach saves a lot of CPU cycles which is important for a multi-tenant application.
  3. Since the Workflow Rule Criteria are evaluated immediately upon saving a record, no other action in the system will affect it other than saving the record again.
  4. As a rule of thumb, do not create Formula fields with functions such as TODAY() and incorporate them into the Rule Criteria or Trigger Date. The passage of time has no effect on Formula fields. It only gets calculated on reading and saving and the system is not continuously reading it in the background.
Tags:

Leave a Reply

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

Copyright © 2009-2015 Hayata Takeshita