MS CRM – 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.

Example:

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

image

Putting it together in a workflow

Create a workflow for cases

eee

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

Startwf

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

checkwfes

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)

 

wf2

wf33

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

wf4

wf3

Add the Wait till Escalation Next Step

wf5

wf6

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.

wf8

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

wf9

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

wf12

image

It should look like this

wf10

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.

wf14

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.

 

Advertisements

About Dynamics CRM Guru

We are a group of CRM Consultants and have rich experience in all Microsoft CRM versions. Currently we provide training in Microsoft CRM 2015/CRM 2013 and CRM 2011.

Posted on February 27, 2011, in Microsoft CRM 2011, Microsoft Dynamics and tagged , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: