What is Goal metric and Rollup fields and what use of Goal metric and Rollup fields in Dynamics CRM. In this article we learn more about it.
The goal metric entity (Metric) and the rollup field (RollupField) entity are used to specify the goal metric type, participating entities, and whether to track actuals, custom or in-progress data. The goal metric and the rollup fields have a parental relationship in which all operations on the parent record are propagated to the child records.
All goals in the hierarchy must be based on the same goal metric and time period. If a child goal that is based on a different goal metric is created, an exception is thrown. If a different time period is specified for a child goal, the system will ignore the specified time period and use the parent goal time period. It is possible to associate a goal with a new metric, if the goal does not have a parent goal or a child goal. Otherwise, an exception throws when the goal record updates.
Goal metric can be of two types:
1. Amount: The Amount metric type expresses as a money value, an integer, or a decimal number.
2. Count: The Count metric type is an integer.
To select Amount or Count, use the Metric.IsAmount attribute. Use the Metric.AmountDataType attribute to specify the Amount data type. The possible values for this attribute defines in the Goal Type (metric_goaltype) global option set. To associate a goal with a metric, use the Goal.MetricId attribute. The following table lists the relationship between the goal metric type and the rollup fields available for each type.
|Goal metric type||Available rollup fields|
|Amount (integer) or Count||Goal.ActualInteger|
To specify other important rollup information, use the rollup field entity.
A source attribute and a goal rollup field must be of the same type, such as money or integer; otherwise, an exception throws when you create a rollup field record.
RollupField.SourceAttributeAn entity attribute from where data rolls up, such as Opportunity.ActualValue or Lead.EstimatedValue.
|RollupField.GoalAttribute||A goal rollup field, such as Goal.ActualMoney, Goal.CustomRollupFieldMoney or Goal.InProgressMoney.|
|RollupField.SourceEntity||A source entity from where data is being rolled up, such as lead, opportunity, or sales order.|
|Rollup Field.Date Attribute||The state of the source record such as “Won” or” Lost” opportunity.|
|RollupField.SourceStatus||The status reason for the state of the source record, such as “Won” for won opportunities, or “Canceled” or “Out-sold” for the lost opportunities.|
|RollupField.IsStateParentEntityAttribute||Indicates whether state or status belong to the parent entity. For example, for the opportunity product that does not have its own state, you can use state and status of the parent opportunity record.|
For each goal metric, it is possible to create up to three rollup field records. Each record can specify actual, in-progress, or custom amount or count.