I'm creating a license expiration system, which notifies license holders of their expiring licenses. At multiple intervals (60/30/15 for example), I will send an email to the license holder. If the license holder provides updated license dates, I want to prevent further emails from going out.

I realize there are multiple workarounds possible to do what I want to do, but each that I come up doesn't provide for an optimal user experience. The most direct way to do this is to be able to just clear out any remaining time-based workflows that haven't been executed.

Therefore, my questions are:

  1. Is it possible to remove unexecuted time-based workflow using either Visual Flow or Apex?
  2. If so, which object(s) do I need to delete or update records on?

Thank you.


The object you're looking for is the WorkflowTimeQueue. However, it does not appear to be accessible from Apex Code or the API, so there's no way you can clear pending entries, other than manually deleting them from the queue in Setup > Monitoring > Time-Based Workflow. Instead, you'll need to edit/modify the record so it no longer meets the criteria, at which point, all pending actions for the rule will be removed from the queue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.