The Microsoft Dynamics CRM Team Blog
News and views from the Microsoft Dynamics CRM Team
What is goal management?
In today’s world, any competitive organization has well defined goals for its members – measurable, and time bound, and with a clear ownership. Goal management in Microsoft Dynamics CRM 2011 lets you set such goals for members in your organization, and also lets you track the progress being made against them. You can set goals with complex queries spanning across multiple records, goal trees spanning organizational hierarchy, monitor their progress on a day-to-day basis, and all this with perfect ease.
So while you are wondering on the immense possibilities in which you can use this feature, our PM buddy Manu has already done a great job summarizing how you can use this feature to cater end-to-end scenarios here.
And now, for those of you, who want to dig deep into this magic vault, and understand what is happening behind the scenes, so that you can build your own applications on top of this, here’s your share of the pie.
Goal Management comprises of four different entities: goal, goal metric, rollup field, and rollup query.
In colloquial language, if you say: In the Quarter 3 of FY2010, Nancy needs to bring in $250000 revenue through opportunities in New York City, this is how this information maps to goal management entities:
I can generalize the above as:
1. Goal: a. Who does it? b. How much? c. In what time? 2. Metric: Is sort of metadata to goal. What is the type of goal you are setting? Types can be a. Count: Goal based on number of records. Like number of phone calls made by David. b. Amount: Goals based on aggregated amounts which come from some fields in a CRM entity. Like actual revenue. This has three sub types: i. Money ii. Integers iii. Decimals 3. Rollup Field: a. The record on which goal is based. b. The attribute in the record which contributes towards the target set in the goal c. The date type attribute which is compared against the timelines of the goal to decide if a record contributes towards this goal or not. d. The value of state/status that the record should have in order to be able to contribute towards a goal. 4. Rollup Query: What all records contribute?
a. Who does it?
b. How much?
c. In what time?
2. Metric: Is sort of metadata to goal. What is the type of goal you are setting? Types can be
a. Count: Goal based on number of records. Like number of phone calls made by David.
b. Amount: Goals based on aggregated amounts which come from some fields in a CRM entity. Like actual revenue. This has three sub types:
3. Rollup Field:
a. The record on which goal is based.
b. The attribute in the record which contributes towards the target set in the goal
c. The date type attribute which is compared against the timelines of the goal to decide if a record contributes towards this goal or not.
d. The value of state/status that the record should have in order to be able to contribute towards a goal.
4. Rollup Query: What all records contribute?
You’ll notice that there’s a slight overlap of “what all records contribute?” between rollup field and rollup query. Here’s my take on it:
If you want your records to be filtered based only on dates, and statecode/statuscode(for example: closed opportunities), then metric will suffice.
Additionally, if you want to consider only those records which are owned by the goal owner, use the ConsiderOnlyGoalOwnersRecords field set to true for this.
But if you ask for anything more than this, while filtering records, you’ll need to use rollup query to define your query. Let’s say, you want to roll up only those opportunities which are in the city of New York, and have estimated revenue greater than $10,000 and are owned by your team, and have the originating lead also owned by your team, all you need to do is: Create a rollup query which has all the above clauses, and associate it to the rollup field you want to use the query for.
Now, that we understand, what each entity is used for, it’s time for some of my developer secrets to be unveiled. Let’s talk about some of the nuances that you need to know while programming for goal:
Goals can be of two types: custom period goal and fiscal period goal.
A fiscal period goal’s timelines match the organization’s fiscal settings. For example if the organization’s fiscal period is quarterly, then you can set quarterly goals, and the start dates and end dates of these goals will align with the organization’s quarter start and end date respectively.
If you do not want to use your org’s fiscal settings, then you can choose your own dates by creating a custom period goal.
Goal Metric: Whenever you create a goal, you associate it with a metric. A metric is not just a reference in goal, but it carries its properties: metricType and goalType to the referring goal as well.
Let us first talk about what we mean by goal rollup.
Goal entity has certain fields that we use to indicate the progress made against the goal. The gathering of this data is termed as rollup.
A goal rollup is a two phase process:
1. For each individual goal, queries are performed based on the rollup fields they are associated with, and aggregates are updated in the goal.
Let’s run this through an example:
We’ll use the out-of-box metric: Revenue for this purpose.
Let’s take the same goal for Nancy that uses the Revenue metric as an example.
If you open Revenue, it has two rollup fields:
So a rollup on Nancy’s goal above will result in two aggregate queries on opportunities:
The Actual(money) field will be updated with an aggregate for Actual Revenue of all opportunities closed as won in Q3 FY20101 in New York.
The In-Progress(Money) field will be updated with an aggregate for Est. Revenue of all opportunities active in Q3 FY2010 in New York.
2. A goal can have one or more child goals, and hence you can create trees of goals to represent goals for an organizational hierarchy. In such scenarios, a child goal contributes towards a parent goal. Let’s say, Nancy reports to David, and David to Kevin. So we have the following hierarchy:
Hence Nancy’s goal contributes towards David’s, and David’s goal in turn contributes towards Kevin’s goal.
So in the second phase, the child goal’s contribution is rolled up to the parent goal, all the way up to the root goal of the goal tree.
While creating a goal, you can choose not to roll up any data from participating records into the goal. The rollup fields in this case will contain data aggregated only from the child goals. So the step 1 in goal rollup section above will not be executed for this goal.
Goal rollup has two modes: asynchronous and synchronous.
There’s a recurring async job that performs the rollup with a frequency configurable in organization settings.
Also, there’s a Recalculate button that you can use to do the rollup for a specific goal tree on an on-demand basis.
You set a target in a goal. The target can be one of the three types: money, decimal, integer, and hence we have the following target fields respectively:
1. targetmoney 2. targetdecimal 3. targetinteger
Based on the metric you are referring, you will use only one of these at any given point of time.
In order to measure how the goal owner is doing, we have a set of rollup fields: Actuals, In-Progress, and Custom.
Actuals – This indicates the actual amounts achieved so far. Example, in case of revenue goals, this can indicate all opportunities closed as won.
In Progress – This is an indicator of the amounts you expect to achieve. Example, in case of revenue goals, this can indicate all open opportunities.
Custom – In case you need to track anything else as a performance indicator, you can use this field. For example, for revenue goals, you have two indicators: open opportunities with rating = hot strongly indicate potential revenue, while those with rating = warm indicate potential revenue, but much less likely than the former. In this case, you can use the In-Progress field for one, and the custom rollup field for another case.
Each of these is again of the three type variants. So we get the matrix:
Once you select a metric, which has one or more rollup fields, mapping to actual, in progress or custom rollup fields in goal, then while working on goal entity, you should use the respective field from rollup field, and respective type from the metric’s goal type.
Again, based on the metric’s goal type, you’ll have a rollup query for your actual, in-progress, and custom rollup fields. Following is the table mapping for rollup query lookup fields and goal’s rollup fields:
Based on your metric’s goal type again, there will be at max three rollup queries in use at any given point.
A set of auto calculated fields have been provided for making your life easy:
Indicates what should be the actual target value as of today based on the target value and the goal’s start date.
Used when goal is a money type goal.
Used when goal is a decimal type goal.
Used when goal is an integer type goal.
Indicates what percentage of the target should the actual be as of today based on the target value and the goal’s start date.
Indicates what is the actual achieved percentage of the goal against the target.
Uses target and actual fields to compute this.
In normal course of things, goal rollups happen in background with a fixed frequency and the rollup fields are updated by the rollup job. However, if you explicitly want to override what the rollup job has calculated for the rollup fields, you can set the isoverride, and isoverridden fields = true and update the rollup fields.
If you set isoverridden to false, then the next rollup on that goal will overwrite these values with calculated values again.
Please note that you can do this only using SDK. The UI does not allow you to do this.
Goal owner vs goal manager: Looking at goal SDK, you’ll find two attributes: goalownerid, and ownerid. Goalownerid stands for the person/team for which the goal is being set. Ownerid is in traditional sense the CRM owner of the record, but since in real life scenarios, a manager governs her reportees goals, hence ownerid is named as Manager in the UI.
A goal rollup always happens in the context of goal’s manager.
In a given goal tree, the following attributes will be same across the tree:
1. Goalperiodtype 2. Goalstartdate/goalenddate 3. Goalmetric
Goal currency: A goal’s currency is defaulted to organization’s currency, and is not valid for update.
Recalculate message: Goal rollup can be done synchronously using the Recalculate message. A recalculate for a goal will recalculate the entire goal tree. For code samples, you can refer to the SDK documentation.
By now you have enough insights to get started with goal management in CRM. Time to get your hands dirty!
Your friendly dev,
Tying CRM to a set of goals is a very powerful tool for sales people to use.