Marketing Tools - Goal Metric And Rollup Fields


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)
Amount (integer) or Count
Amount (decimal)

Specify Rollup Fields

To specify other important rollup information, use the rollup field entity.
Rollup information
A goal rollup field, such as Goal.ActualMoney, Goal.CustomRollupFieldMoney or Goal.InProgressMoney.
A source entity from where data is being rolled up, such as lead, opportunity, or sales order.
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.
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.
The state of the source record such as “Won” or” Lost” opportunity.
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.
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.