ForecastingSourceDefinition

Represents the object, measure, date type, and hierarchy that a forecast uses to project sales.

Where possible, we changed noninclusive terms to align with our company value of Equality. We maintained certain terms to avoid any effect on customer implementations.

Important

Parent Type 

This type extends Metadata and inherits its fields.

File Suffix and Directory Location 

ForecastingSourceDefinition components have the suffix .forecastingSourceDefinition and are stored in the forecastingSourceDefinitions folder.

Version 

Introduced in API version 52.0.

Fields 

categoryField 

  • Type: string (enumeration of type string)
  • Required: No
  • Description: Name of the forecast category that is associated with the forecast type.
  • Possible values:
    • Opportunity.ForecastCategoryName

cdpDataspace 

  • Type: string
  • Required: No

dateField 

  • Type: string (enumeration of type string)
  • Required: No
  • Description: Field that is used for the forecast type’s date type. For example, the CloseDate field on Opportunity is used for opportunity close date-based forecast types.
  • Possible values:
    • Opportunity.CloseDate
    • OpportunityLineItem.ServiceDate
    • OpportunityLineItemSchedule.ScheduleDate

externalSourceObject 

  • Type: string
  • Required: No

familyField 

  • Type: string (enumeration of type string)
  • Required: No
  • Description: Use this field to group forecasts by product family.
  • Possible values:
    • Product2.Family

isProtected 

  • Type: boolean
  • Required: No
  • Description: Indicates whether this component is protected (true) or unprotected (false). Protected components in a managed package can’t be referenced by subscriber org customizations.

masterLabel 

  • Type: string
  • Required: Yes
  • Description: Required. Controlling label for this forecasting source definition.

measureField 

  • Type: string (enumeration of type string)
  • Required: No
  • Description: Field that is used for the forecast type’s measure. For example, the Amount field on Opportunity is associated with revenue-based forecast types. Possible values are*: *Where Custom represents the name of the custom field that a forecast type’s measure is based on. Example: Use Megawatts__c to forecast energy consumption.
  • Possible values:
    • Opportunity.Amount
    • Opportunity. Custom
    • Opportunity.TotalOpportunityQuantity
    • OpportunityLineItem. Custom
    • OpportunityLineItem.Quantity
    • OpportunityLineItem.TotalPrice
    • OpportunityLineItemSchedule. Custom
    • OpportunityLineItemSchedule.Quantity
    • OpportunityLineItemSchedule.Revenue
    • OpportunitySplit. Custom
    • OpportunitySplit.SplitAmount

sourceObject 

  • Type: string (enumeration of type string)
  • Required: No
  • Description: Required. Object associated with this forecasting source definition.
  • Possible values:
    • Opportunity
    • OpportunityLineItem
    • OpportunityLineItemSchedule
    • OpportunitySplit
    • Product2

territory2Field 

  • Type: string (enumeration of type string)

  • Required: No

  • Description: For a territory-based forecast type, indicates the field that is used for territory information.

    For user role-based forecast types, this value is null.

  • Possible values:

    • Opportunity.Territory2Id

userField 

  • Type: string (enumeration of type string)
  • Required: No
  • Description: Specifies who owns the forecast.
  • Possible values:
    • Opportunity.OwnerId
    • OpportunitySplit.SplitOwnerId

Declarative Metadata Sample Definition 

The following is an example of a ForecastingSourceDefinition component.

1<?xml version="1.0" encoding="UTF-8"?>
2<ForecastingSourceDefinition xmlns="http://soap.sforce.com/2006/04/metadata">
3    <masterLabel>TestFsd</masterLabel>
4    <sourceObject>Opportunity</sourceObject>
5    <measureField>Opportunity.Amount</measureField>
6    <dateField>Opportunity.CloseDate</dateField>
7    <userField>Opportunity.OwnerId</userField>
8    <categoryField>Opportunity.ForecastCategoryName</categoryField>
9</ForecastingSourceDefinition>

The following is an example package.xml that references the previous definition.

1<?xml version="1.0" encoding="UTF-8"?>
2<Package xmlns="http://soap.sforce.com/2006/04/metadata">
3    <types>
4        <members>*</members>
5        <name>ForecastingSourceDefinition</name>
6    </types>
7    <version>52.0</version>
8</Package>

Wildcard Support in the Manifest File 

This metadata type supports the wildcard character * (asterisk) in the package.xml manifest file. For information about using the manifest file, see Deploying and Retrieving Metadata with the Zip File.

Usage 

  • Forecast types that were available before API version 52.0 can be activated, deactivated, and deleted but not created. To enable an existing forecast type, update the active flag.
  • Forecast types that are available only in API version 52.0 and later can be created, activated, deactivated, and deleted. If the forecast type doesn’t exist, it is created in the inactive state. If the forecast type exists, the active flag is updated. Deploy the zip file twice to create and activate the forecast type.
  • Deploy Metadata API types in the following sequence: ForecastingSettings, ForecastingType, ForecastingSourceDefinition, and then ForecastingTypeSource. If all are specified in the package file, the sequence is followed automatically.