+ Start a Discussion
MattWelchMattWelch 

Canceling time-dependent workflow actions

I've got a workflow that will send out an email after 1 hour if a particular set of conditions are met. To simplify, let's say the workflow formula is

 

fieldA__C==1 && ISPICKVAL(fieldB__c,"Location B")

 

I can successfully get the email sent after an hour when I set fieldA__C to 1 and fieldB__c to "Location B". What I want, though, is for that email to NOT go out if the workflow formula evaluates to false after the email is already been queued. That is, the workflow evaluates to true, and queues up the email. Then I change, say, fieldA__c to 2. I was under the impression, from reading the help docs, that this would dequeue the pending email. Real-life experiments seem to indicate otherwise, though, as I still get the email.

 

Any input would be appreciated.

 

BTW - Here's the relevant section from the help docs:

"Time-dependent actions remain in the workflow queue only as long as the workflow rule criteria are still valid. If a record no longer matches the rule criteria, Salesforce removes the time-dependent actions queued for that record. "

 

https://login.salesforce.com/help/doc/en/workflow_time_action_considerations.htm

sfdcfoxsfdcfox

I just tested this in my developer edition, and it works as advertised, as I suspected it should. Either your rule's filters aren't set up the way you think they are, or you're waiting to close to the cutoff time. The delayed actions are evaluated only once per about fifteen minutes or so, on a timer that is started when the instance first boots up (so not necessarily :15, :30, :45, and :00 each hour). Processing may take a couple of minutes, and if it's already started, your action would probably execute if it's already under processing when you try to edit the record.

 

If neither of these two conditions are true, then check your time-based workflow queue under Setup > Monitoring > Time-Based Workflow, and perform various edits and refresh the queue list to see if they are appearing/disappearing as expected. If not, then consider contacting Technical Support, as they can log in to your system using their administration tools to document and/or resolve the issue and send it to the appropriate people for resolution if they can't solve it.

 

In my personal experience with supporting Salesforce, I find that the most usual malfunctions of the Time-Based Workflow system are simple filter misconfigurations (I'm even guilty of a few of those). However, system bugs are also fairly well-known for cropping up from time to time, and it may be that you've run into one of those bugs using a particular set of filters that cause the bug to manifest itself. In that case, it should work itself out in a hotfix, but contacting support so it's documented is a good idea.

 

Finally, make sure you read all the little caveats they mention in the Help & Training window; if you turn off the rule, the time dependent actions can still fire, and they won't be removed because of edits, since the rule is not active. In practice, it is best to: create the rule, attach all necessary logic to the rule, then activate the rule, in that order. Any other order tends to produce unusual results.

Mats ErikssonMats Eriksson

Did you find root cause of your problem Matt?

 

/Mats

cmendlercmendler

We experienced this issue, also.  Time-dependent workflows were scheduled when a bunch of leads were loaded and the workflow was scheduled for each.  The leads then went through our lead routing process and some were updated via automation.  Those leads that were updated were not removed from the scheduled workflow queue and after some research, we found out why:

 

"Time-based workflow rules aren't reevaluated if an Apex post trigger which is executed as a result of a workflow rule or approval process updates a field so its value no longer meets the time-based workflow rule criteria."

 

Since the leads were updated via our automated lead routing process, they were not reevaluated against the workflow criteria.  Only manual updates are reevaluted.   So our updated leads were not reevalutaed nor removed from the queue.  Back to the drawing board....

 

 

Tony DyckTony Dyck

We have come across this issue and looks like updating the record after the field update in an @future method will remove the time based workflow action if it no longer meets the criteria.