Share

Scheduling Recurring Goals in Microsoft Dynamics CRM 2011

In my previous post, I discussed using goals to enable rollup notifications in Microsoft CRM. One piece of feedback that I get when I tell people about the goal functionality in CRM is “that looks really nice, but it would take a lot of work to manually create goals for frequently repeating time periods?” This is true –If you are creating quarterly or annual goals, it is not very difficult to manually create goals; however, if you want to measure something on a daily or weekly basis, having to manually create a goal for each time period would not be practical.

The good news is, that it is not very difficult to have CRM automatically create recurring goal instances. Here is one way to do it:

1. Create a goal schedule entity

In my example, I’ve created a custom entity called goal schedule. This entity has two fields: A lookup to goal and an option set for Goal Type. Goal type includes the options daily, weekly, and monthly.

image

2. Create a workflow

Create a workflow called “Goal Recursion” triggered on create of a Goal Schedule record. Insert a wait condition to timeout 1 minute after the “To” field on the goal. Insert a check condition substep checking if the Goal Type equals “Daily.”

 

image

If the Goal Type equals daily, then create a goal, mapping the values of the original goal record to the new goal record, and setting the “From” and “To” values to 1 day after their original goal values.

image

Then add a substep to update the Goal Schedule record and set the lookup link for Goal to the newly created goal record.

image

Add a conditional branch for if the Goal Type equals “Weekly.” As we did in the Daily conditional branch, create a new goal record, this time setting the To and From fields to 7 days after the original goal’s date values, and set the Goal Schedule goal lookup to the newly created goal record.

image

Now we have a workflow that will allow you to configure any goal to automatically get recreated on a daily or weekly basis. You could also do this same approach for monthly goals; however, one thing to consider with monthly intervals is that different months have a different total number of days. So if you have the workflow add 1 month to January 31, it will set the next record to February 28th (or 29th on leap year). However, If you add 1 month to February 28th, the next record will be set to the 28th of March, not the last day of the month.

My recommendation for monthly goals is to set the interval from day 1 to day 1—January 1 to February 1, for example. Adding a month to the first day of the month always falls on the 1st of the month, and if you look at the time associated with the “To” value on a goal, it uses 6:59 AM, so you would want to go to the first of the month to include every day of the prior month.

So now for my recurring goals, I just create the first goal record, create my goal schedule record, and CRM will automatically recreate the goal on the desired interval.

Free Guide
On-Premises vs. Cloud CRM

A guide to help you determine the best solutions for you.