Understanding Waits and Timeouts in Dynamics CRM Workflows

When to Wait, When to Timeout?

When it comes to workflows in Dynamics CRM, timing isn’t the only thing that matters, but it’s definitely up there. In the 4.0 release we have lots of flexibility in this area, and I know from the questions I often get (not to mention my own learning experience!) how confusing it can be to keep the different options all straight. Need to learn about workflows in Dynamics CRM? Consider my one-day live online class, Building Workflows in Dynamics CRM, which also includes a copy of my book on the topic.

In particular, the “Wait” and “Timeout” conditions are both important ways of pausing a work process, and they seem similar, at least at first. As it turns out, they serve quite different functions, and I’ll try to clarify them here with a brief explanation and a couple examples:

Use Wait when you want a work process to pause until a condition changes. Some common examples of the kinds of conditions you might Wait for include:

  • Wait until an assigned task is completed
  • Wait until the status or status reason of a record changes
  • Wait until the value of an attribute in a related entity changes

Use Timeout when you want a work process to pause until a specified date, for a specified period of time, or until you reach a date relative to the value of a CRM record’s date field. Some examples of these include:

  • Timeout until an Opportunity record is “overdue” (the current date is greater than the opportunity’s estimated close date)
  • Timeout until September 1, 2009 (maybe there’s a conference coming up on September 8 and you want to send a one-week reminder email to attendees)
  • Timeout until one week has passed since a new Account record was created

In Dynamics CRM-speak, we can say that a Wait condition will be met when the attribute value of some entity changes. On the other hand, a Timeout condition will be met when time passes: either clock time or time relative to the value of a date attribute of some entity. My little mnemonic to help me remember is that of the two conditions, only Timeout contains the word “time”. Clever, eh?

Using a Wait in a Workflow

Here’s an example of a Wait condition: a simple sales process might have stages, and one or more stages might assign tasks. There’s nothing about creating and assigning a task record in Dynamics CRM that makes a workflow pause, so if you want to make sure the task gets completed before going on, you can add a condition, to the effect “Wait until activity status=completed”. The following screenshot shows a simple sales process implemented as a workflow on the Opportunity entity. It starts automatically, when a new opportunity is created, and has these characteristic Wait until conditions in each of the first two stages of the sales process:

 

screenshot of Dynamics CRM workflow with stages

Using a Timeout in a Workflow

I understood Waits before I understood Timeouts – probably because the latter are a little harder to find! One of my favorite examples of using a Timeout in a workflow is another aspect of a sales process: making sure that opportunities don’t go past their estimated close date (or at least, if they do, make sure you take appropriate action!). Here’s a simple implementation of that logic, in an automatic opportunity workflow that starts by timing out until one day before the “Est. Close Date” of the opportunity and sends a reminder email. Next, it times out until seven days after the opportunity was supposed to close…and closes it out if it is. (Implementing a process like this might be a culture shock for some sales organizations, so you might want to warn them in the reminder email that this will happen.)

Dynamics CRM Workflow Step Editor with Wait Timeout Condition

If you clicked on the second of these two Timeout conditions, here’s what the condition looks like:

Screenshot of how to configure a Timeout condition in a Dynamics CRM workflow

Like I said, this is pretty well hid! In order to add the Timeout condition, you first have to select Wait Condition from the Add Step menu, and only when you open the Specify Workflow Condition dialog do you actually configure the Timeout! Within the Specify Workflow Condition dialog you do this by selecting the somewhat cryptic “Workflow” value from the first column’s drop-down menu, and then selecting Timeout in the second column, as the previous screenshot illustrates. After selecting Timeout, you’ll see that “Equals” is your only option in the third column, and then you use the Form Assistant to configure the Timeout. In the example I show here I followed these steps to configure the condition:

  1. selected “7″ in the Days field
  2. selected “After” in the next field
  3. selected the Opportunity entity in the Look for pull-down
  4. selected “Est. Close Date” as the field to make the Timeout condition evaluate

This takes a little getting used to, but after you do it a few times you get the hang of it.

(In my opinion, this would be easier to understand if you could select either Wait Condition or Timeout Condition from the Add Step menu directly, but then I didn’t design the CRM 4.0 workflow design UI.)

If you found this helpful, my book on Building Workflows in Dynamics CRM 4.0 has detailed explanations of topics like this one plus lots of others, and downloadable versions of the example workflows. Here’s a link to the page on Lulu.com where you can find out more and buy the book

Cheers – Richard Knudson, richardk@imginc.com

10 Comments »

  1. Zarko Radevic Said,

    June 15, 2010 @ 3:15 am

    Hi Richard,

    I find your post very useful and I would appriciate if you responded to my question: What if I set a Timeout step and someone changed the date field to which the step is bound.

    Thanks in advance

  2. Andrew C Said,

    June 17, 2010 @ 9:28 am

    I have a similar workflow that ‘Timeout” until one day prior to the Opportunity “Estimate Due Date” and then it checks to see if the Opportunity is still OPEN. If it is still open it send an email. We only turned up CRM for 6 mths now and I have many instances of this workflow running in Timeout mode. I am concerned that all of these instances will bog down our installation at some time.

    Any suggestions?

    Thanks

  3. Richard Knudson Said,

    June 17, 2010 @ 9:33 am

    Hi Zarko and Andrew —

    Your two excellent questions have some things in common. I’ll work up some examples and a writeup and make a separate post on the topic in the next day or so. Thanks for the questions and thanks for reading!

    Cheers – Richard

  4. Richard Knudson Said,

    June 23, 2010 @ 8:14 am

    Hey guys — I wrote up an example that answers your questions: http://www.dynamicscrmtrickbag.com/2010/06/22/waits-timeouts-and-recursive-workflows/

    Let me know if you have any questions!

    Richard

  5. dml Said,

    August 20, 2010 @ 8:13 am

    Hi, Richard
    I need a workflow that will change another attribute when a specific attribute (End Date) is changed to equal the current system date.

    I have put a wait condition in my workflow to begin with…but I can’t figure out how to indicate current system date. All have is a drop down with a calendar to choose a date from.

    Can you assist me?

    thank you

  6. Richard Knudson Said,

    August 23, 2010 @ 7:10 pm

    Hi dml,

    I think what you need is a Timeout condition, not the standard Wait condition. Have you tried a Timeout?

  7. dml Said,

    August 25, 2010 @ 8:31 am

    I have not tried this. How would I create a timeout? I need for the workflow to run only if the End Date is prior to or equal to system current date.

    I would really appreciate your assistance. Thank you

  8. Richard Knudson Said,

    August 25, 2010 @ 7:24 pm

    Hi Dina,

    OK, finally I recorded a video to demonstrate this. You aren’t the only one who ever asked me about it, so hopefully this helps! http://www.dynamicscrmtrickbag.com/2010/08/25/crm-4-workflow-timeouts-how-to/

  9. Nathan Said,

    January 24, 2012 @ 9:07 pm

    Hi, Does anyone know if there is a limit to the number of Timeouts in a single workflow? I’m running CRM 2011 and seem to be encountering a limit of 7. Thanks

  10. Richard Knudson Said,

    January 27, 2012 @ 6:48 am

    Hi Nathan,
    What does your workflow do? I’m not familiar with a timeout limitation. Is it a recursive workflow? There is a limit on how many times a workflow can recurse, but even that depends on how quickly it recurses. If you describe your scenario in more detail I might be able to help.

    Richard

Leave a Comment