Friday, 14 June 2013

Waits and Timeouts in Dynamics CRM Workflows When to Wait, When to Timeout

Check Condition and Wait Condition as the flow in workflow: they provide the foundation for implementing logic in business processes. Of the two constructs, Check Condition is easier to understand: You check to see if a condition is true, and then do something if it is.
Wait conditions introduce a time dimension to your processes, and one of the reasons they’re a little harder to learn is that they come in two flavors: Wait and Timeout.
The wait and timeout conditions are both important ways of pausing a 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
A timeout is pretty easy to understand once it’s created, but creating it is the tricky part. If you need to add a timeout condition to a workflow process, follow these steps in the process designer:
  1. Click the Add Step drop-down menu, and select Wait Condition.
  2. Click the <condition> (click to configure) link to open the Specify Condition dialog.
  3. From the drop-down list in the first column, select Process (in the Local Values section), and tab to the second column.
  4. Select Timeout from the drop-down.
  5. Tab to the next column and select Equals (the only option)
  6. Tab to the next column and then use Dynamic Values to set the timeout period relative to the Est. Close Date field, performing the next three steps in the Dynamic Values section:
  7. Select “7″ in the Day selector on the first row.
  8. Select After in the drop-down on the second row.
  9. Make sure that Opportunity is selected in the third row, and then select the Est. Close Date field in the fourth row. The Specify Condition dialog should now look like this:

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