I saw this blog post today by Yaniv Arditi, what I really liked about the solution was how simple and elegant it was. It also used the functionaility in CRM, it reminds you about how useful and powerful workflows are.
I have put this on my blog so I can find this again because I’m sure that sometime in the future I will have to do something like this, in the past this has usually been done programming with .NET code, this solution offers an alternative to that. It could be used by consultants who haven’t got access to a developer.
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
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.
3. Select the Anniversary attribute to trigger the record attribute change event
4. Add a Wait condition to wait until the Contact’s next Anniversary date
5. Add a ‘Send E-mail’ step, set the required email template (assuming you have one) and email details
6. Add an ‘Update Record’ step and set it to update the Contact’s anniversary date to next year Anniversary date
7. By the end, your work flow rule should look something like this:
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.