Workflow Best Practices – Reduce Wait time

As many of you know, the more items you have in a wait state in MSCRM the slower the system can perform. On of the best practices is to wake up every so often and perform your check and go back to sleep if the condition doesn’t meet.



Case: Wait 7 days and if the Status is not Completed then Send an escalation Email.

Best Practice would have workflow do some thing like this. (This is pseudo code)

Wait 1 day
If Status = Close then Stop Workflow
Wait 1 day
If Status = Close then Stop Workflow
Wait 1 day
If Status = Close then Stop Workflow
Wait 1 day
If Status = Close then Stop Workflow
Wait 1 day
If Status = Close then Stop Workflow
Wait 1 day
If Status = Close then Stop Workflow
Wait 1 day
If Status = Close then Stop Workflow
Send Escalation Email

Well, what if you wanted to change the durations from 7 days to 3. Worse yet, this is a 30 day wait process with 30 of those wonderful lines. The answer is that you can change the workflow, but all of the currently running workflows will still have the old code instantiated and they need to work through.

I came up with another method, some of you may have done the same, to make this more manageable.


I added to the case 3 fields.

  • Escalation – Next Wake up
    • This is a date and time for the workflow to next wake up
  • Escalation – Wakeup Count
    • This is an integer that tells you how many times the workflow has waited
  • Escalation – Escalation On
    • This is an integer that when the Escalation – Wakeup count is equal to or greater than it escalates


Putting it together in a workflow

Create a workflow for cases


Change the Scope to Organization and check off the As a Child Workflow


Add a check condition step to check the case Escalation – Next Check is blank.


Add under the if statement un update to the case Escalation – Next Check to be create on date time and set the Escalation – Wakeup Count to 1 plus the Escalation – Escalate On to 7 (1 week)




Now on a new line add the Add 1 day to the Escalation – Next Check



Add the Wait till Escalation Next Step



Now do your check to see if the condition is right to quit this workflow. In this case if the case is not active then we do not need to escalate. Stop the workflow if it is true.


Now add the escalation logic. If Escalation – Wakeup Count is => Escalation – Escalate on then send escalation and stop


Add 1 to the Escalation – Wakeup Count. Add un update to the case



It should look like this


Now add the last step and that is to call this workflow . NOTE. You will need to save the workflow before you can call it.



Publish and now try it. You will find that it is easier to update the Escalation process even on items currently running. Plus you have an easy way to force many workflows to stop within a day if needed. Enjoy and I hope this helps.


Bill Owens

Steven Jennings
Steven has more than five years of Microsoft Dynamics CRM implementation expertise. As CRM Team Lead at Affiliated, his main focus is in sales, marketing, and service areas. He has a strong background designing and deploying integrated solutions, he also has over eight years of .NET development expertise. Steven is proficient in all phases of project development, from concept through realization and assists in the management of a team of analysts and developers responsible for the organization's applications development and analysis functions. He evaluates existing applications to determine technical changes, schedules projects and resources, and monitors project timelines. For more information or to contact Steven, feel free to email him here.
No comments yet.

Leave a Reply

Capcha * Time limit is exhausted. Please reload the CAPTCHA.


Follow this blog

Email address