Marketing Tools - Goal Metric And Rollup Fields

Introduction

 
In this blog, you will learn about the marketing tools - Goal Metric and Rollup Fields. 
 

Goal Metric and Rollup Fields

 
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 is thrown when the goal record is updated.
 

Create a Goal Metric

 
Goal metric can be of two types:
  1. Amount
    The Amount metric type is expressed 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 are defined 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 (money)
Goal.ActualMoney
Goal.InProgressMoney
Goal.CustomRollupFieldMoney
Amount (integer) or Count
Goal.ActualInteger
Goal.InProgressInteger
Goal.CustomRollupFieldInteger
Amount (decimal)
Goal.ActualDecimal
Goal.InProgressDecimal
Goal.CustomRollupFieldDecimal
 

Specify Rollup Fields

 
To specify other important rollup information, use the rollup field entity.
 
Attribute
Rollup information
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.
RollupField.SourceAttribute
An entity attribute from where data is being rolled up, such as Opportunity.ActualValue or Lead.EstimatedValue. A source attribute and a goal rollup field must be of the same type, such as money or integer; otherwise, an exception is thrown when you create a rollup field record.
RollupField.DateAttribute
The date that is validated against the goal time period, such as Opportunity.ActualCloseDate or Lead.EstimatedCloseDate. A record participates in the goal rollup, if the specified date falls between the start date and the end date for the goal. For example, if an opportunity is closed between the start and end dates for the goal, revenue generated from this opportunity is added to the goal’s total revenue; otherwise, it is not included.
RollupField.SourceState
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.