How to create a repeating schedule workflow rule

February 10, 2009

I am often asked by my clients if Microsoft Dynamics CRM 4.0 can automatically schedule and perform a repeating task, such as sending an email notification to a Contact every year or adding a Note to a Contact record every day.

One trivial solution to this problem is developing a custom module that will be repeatedly launched by Windows Scheduled Tasks feature or Windows Service and perform the required task.

Another solution, one that does not require writing code, can be implemented using the Work Flow engine.
Let’s take, for example, a scenario in which we would like to automatically send ‘Happy Anniversary’ email greeting to our Contacts on their Anniversary day.

The following 8 steps describe how to set up the required work flow rule:

1. Create a new blank work flow rule for the Contact entity

image

2. Set the rule to be triggered by both the record Creation and Attribute change events. Set the scope to user, at least until you have tested the rule. 

image

3. Select the Anniversary attribute to trigger the record attribute change event

image

4. Add a Wait condition to wait until the Contact’s next Anniversary date

image

5. Add a ‘Send E-mail’ step, set the required email template (assuming you have one) and email details

image

6. Add an ‘Update Record’ step and set it to update the Contact’s anniversary date to next year Anniversary date

image

7. By the end, your work flow rule should look something like this:

image

8. Publish the work flow rule

9. Test the rule by creating a new pseudo Contact with a future date (e.g. tomorrow) as anniversary date and your email address. If all went well, you should be able to see a new rule instance waiting in the Contact’s workflows grid.
Past the target date, verify that the workflow rule has advanced and that you have received the greeting email. Also make sure the Contact’s Anniversary date has been updated to next year anniversary date.

Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*

6 comments

  1. JuliuxMay 1, 2009 ב 2:46 AM

    Great example, it is just what i needed it.

    Can the server’s performance be affected if we have many workflows that works like this one? (I have to create 10 workflows like this one)

    Reply
  2. YanivMay 11, 2009 ב 8:40 AM

    Hi Juliux,

    10 running instances shouldn’t have a major impact on your server performance but it is always recommended to separate the database server from the application server.
    As in version 4.0 the Asynchronous processing can be distributed to another machine, you can use this ability ever you discover a performance issue arises.

    Reply
  3. jimNovember 23, 2010 ב 11:56 AM

    What happens if someone creates the contact and then edits it? Will there be two workflows running, waiting for the anniversary date? Will two emails be sent?

    Reply
  4. Asher KohnDecember 27, 2010 ב 10:31 AM

    Hi,
    What happens in case the account already exists? How would the workflow be initially triggered?

    Reply
  5. LeeMarch 27, 2011 ב 9:14 PM

    thanks for sharing, Yaniv.
    I am also thinking about the workflow scheduler.
    How could you schedule a workflow which will be conducted in each month or each week. The only time-related attribute is data-time and the date is required, which means I can not schedule the workflow only by time.
    Thanks for replying.

    Reply
  6. コーチ財布通販September 8, 2012 ב 10:19 AM

    Much informative and useful article… I like it personally…

    Reply