Tip #122: If you must use waiting workflows

In yesterday’s tip we suggested to avoid wait conditions altogether; but if you must use them:

4 thoughts on “Tip #122: If you must use waiting workflows

  1. AdamV says:

    I would suggest that for anything that needs a long wait* you should call a child workflow to do the waiting, and then that calls a child to do the follow-up action. This allows you to change any one of the parts without disrupting the “in flight” workflows. And for the most part, the only workflows in flight will be the waiting ones. So you can change the logic of the initial part that makes decisions, or the actions taken after the wait with no great difficulty.
    You can also change the logic of the waiting part (eg how long to wait, or adding a parallel wait to drop out early) and the only thing that will fail is the call to this workflow while it is offline. You can rename, reactivate and then resume those that tried to call it and they will work happily (as long as the time it takes you to edit is less than the usual wait time, or the exact timing is non-critical, this approach is OK).
    You can kick off a whole bunch of new waiting workflows using an on-demand “trigger” workflow, based on an advanced find query of records that have an old waiting workflow instance against them. Then find the old workflow system jobs related to records that have a new waiting workflow against them as well (because it has a new name, or based on start time) and cancel those.

    *how long is a LONG wait? Longer than it take the business to change their mind or their processes.
    In some organizations with very formal change management procedures, this could be months.
    In some businesses, it seems that the CEO will just turn around and decide the wait in a sales process until two months before the end of a contract agreed in yesterday’s meeting with 20 people should be only one month, and it must be changed as of NOW, and retrospectively. Tomorrow he might change his mind again…

  2. […] fellow tipster Joel suggested in his last tip some fine tuning when it comes to […]

  3. Adam Roberts says:

    Hey guys, quick question…if I have a workflow that has a bunch of system jobs currently in wait steps, can i deactivate it to make some quick changes? Or I should add, will those waiting processes be killed or would they potentially still be waiting when I re-activate?

    • Joel Lindstrom says:

      existing waiting steps don’t get killed when you deactivate. If you deactivate, make changes, and then republish, the existing waiting instances will still be active with the original definition–they don’t automatically inherit the changes you make when you update the workflow. That is the reason for the tips in the waiting workflow category recommend using child workflows for the Action step–that way you can change what happens and have existing waiting instances call the child process, and changes made to the child workflow will get included when the wait condition is up.

Leave a Reply

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