Quantcast
Channel: Microsoft Dynamics 365 Community
Viewing all articles
Browse latest Browse all 10657

Scheduled recurring workflows in Dynamics CRM 2011

$
0
0

Dynamics CRM 2011 does not have the ability to schedule recurring workflows out of the box but it does seem to be a common request. CRM team member Hamish has some answers for you. If you would like any more information, please ring or email me.

A blog by Gonzalo Ruiz http://gonzaloruizcrm.blogspot.co.nz/2011/05/quite-often-we-have-business-process.html gives a good explanation on how to use a wait step in CRM workflows to schedule a recurring workflow, but what if you want a recurring workflow that runs at exactly the same time each day or week?

We had a recent requirement to schedule some processing of CRM records on a nightly basis out-of-hours. To do this in CRM we developed a workflow which used a custom workflow activity to do the processing and a wait step to wait until the next time the processing was to be actioned again. If the workflow was to run at 1am each morning then starting the workflow manually at 1am and using a wait condition of timeout until 1 day (as per the screenshot below) would not work, as the start time would slip a little each day from 1am. i.e. the time it takes the workflow to run + 1 day. 

In order to achieve a consistent start time of 1a.m. each morning a very simple and configurable custom workflow activity was developed. The workflow activity takes input parameters of the number of days to wait and the hour of the day to run the workflow. The custom workflow activity outputs a datetime object to be used in the workflow wait step. The screen shot below shows the configuration of the workflow activity to generate a datetime that is 1am in one day's time. 

The example workflow below waits until the scheduled time is hit, completes the processing and then runs itself as a child workflow to start the process all over again. 

It is very important that the warnings that Gonzalo has written at the end of his blog post on scheduling workflows are taken into consideration when using the wait condition for recurring workflows. A waiting workflow consumes resources from the CRM Asynchronous Service, so if there are a number of waiting workflows then they could slow down the async service considerably.

-------------------------------------------------------

Kristy Brown

Dynamics CRM Service Line Manager

Koorb Consulting

+64274 774 384

The article Scheduled recurring workflows in Dynamics CRM 2011 was first posted at Koorb Consulting

 


Viewing all articles
Browse latest Browse all 10657

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>