ForecastingSourceDefinition defines the source object, measure, date basis, and hierarchy that a forecast uses to project sales. It describes the data behind a forecast; it does not activate the forecast type.
Read its settings together: sourceObject identifies the source, measureField identifies the metric, dateField establishes the date basis, and userField and territory2Field describe ownership and hierarchy. The component's metadata identity, fullName, is separate from its controlling label, masterLabel.
Key Elements
| Element | What the Element Controls |
|---|---|
fullName |
Inherited metadata identity of the source definition. Do not confuse it with the label. |
masterLabel |
Required. Controlling label for the source definition. |
sourceObject |
Required. Documented values are Opportunity, OpportunityLineItem, OpportunityLineItemSchedule, OpportunitySplit, and Product2. |
measureField |
The field whose value the forecast measures. Documented standard values are Opportunity.Amount, Opportunity.TotalOpportunityQuantity, OpportunityLineItem.Quantity, OpportunityLineItem.TotalPrice, OpportunityLineItemSchedule.Quantity, OpportunityLineItemSchedule.Revenue, and OpportunitySplit.SplitAmount. Custom numeric measure fields are also supported on these four objects. |
dateField |
The forecast's date basis. Documented values are Opportunity.CloseDate, OpportunityLineItem.ServiceDate, and OpportunityLineItemSchedule.ScheduleDate. |
userField |
Who owns the forecast: Opportunity.OwnerId or OpportunitySplit.SplitOwnerId. |
territory2Field |
Territory information for territory-based forecast types: Opportunity.Territory2Id. For user role-based forecast types, this value is null. |
categoryField |
The forecast-category field reference, Opportunity.ForecastCategoryName, rather than a literal forecast-category value. |
familyField |
The field used to group forecasts by product family: Product2.Family. This is a field reference, not a product-family value. |
Behavior and Constraints
Object support and field support are different questions. Although sourceObject references object metadata represented by CustomObject, that relationship does not establish support for arbitrary custom objects as forecast sources. The documented source-object values are the five objects listed above.
The allowed-value lists also do not establish that every source, measure, and date combination is valid. For example, listing Product2 as a source object does not make every documented measure or date field valid with it. Interpret these settings as one forecast configuration, not as independent choices.
Custom measures use actual field API names. In the documented patterns Opportunity.Custom, OpportunityLineItem.Custom, OpportunityLineItemSchedule.Custom, and OpportunitySplit.Custom, Custom is a placeholder. A custom measure on Opportunity can be expressed as Opportunity.Megawatts__c; do not deploy the word Custom as the field name.
Ownership depends on the configured owner field. Opportunity.OwnerId follows the opportunity owner, while OpportunitySplit.SplitOwnerId follows the split owner. This distinction matters when explaining whose forecast receives the measure.
A null territory field can be correct. Territory-based forecast types use Opportunity.Territory2Id. User role-based forecast types have a null territory2Field, so null alone does not indicate an incomplete hierarchy configuration.
Deployment and Retrieval
Components use the .forecastingSourceDefinition suffix and are stored in the forecastingSourceDefinitions folder. The type supports the * wildcard in the package.xml manifest for deployment and retrieval.
Deploy the related metadata in this sequence:
ForecastingSettingsForecastingTypeForecastingSourceDefinitionForecastingTypeSource
When all four types are specified in the same package file, Salesforce follows this sequence automatically.
Creating and activating a forecast type can require two deployments. For forecast types that support creation, a new forecast type is created inactive. Deploy the ZIP file twice to create and activate it. When the forecast type already exists, deployment updates its active flag. This lifecycle belongs to the forecast type, not to an active flag on ForecastingSourceDefinition.
Before changing or removing a source definition, inspect the actual ForecastingTypeSource mappings and ForecastingFilterCondition components that reference it. These identify affected configuration; a reference by itself does not establish that a forecast type is active.
Relationships
The source object and field settings connect the definition to object and field metadata. Their configured values determine which objects and fields participate. Other forecasting components can reference the definition directly or as a parent source definition.
References
-
CustomObject:sourceObject. -
CustomField:categoryField,dateField,familyField,measureField,territory2Field,userField.
Referenced By
-
ForecastingTypeSource:forecastingSourceDefinition,parentSourceDefinition. -
ForecastingFilterCondition:forecastingSourceDefinition.
Common Questions
Why is my forecast type inactive after deploying ForecastingSourceDefinition?
The source definition does not activate the forecast type. For forecast types that support creation, the first deployment creates the forecast type inactive; deploy the ZIP file twice to create and activate it. An existing forecast type has its active flag updated during deployment.
Can ForecastingSourceDefinition use a custom object as its source?
The documented source objects are Opportunity, OpportunityLineItem, OpportunityLineItemSchedule, OpportunitySplit, and Product2. The relationship to CustomObject metadata does not establish support for arbitrary custom objects.
How do I specify a custom forecast measure?
Use the object name followed by the actual custom field API name, such as Opportunity.Megawatts__c. Custom numeric measures are supported on Opportunity, OpportunityLineItem, OpportunityLineItemSchedule, and OpportunitySplit. The word Custom in the documented patterns is only a placeholder.
Is a null territory2Field a configuration error?
Not by itself. User role-based forecast types have a null territory2Field. Territory-based forecast types use Opportunity.Territory2Id.
How do I retrieve all ForecastingSourceDefinition components?
Use ForecastingSourceDefinition as the type name and * as the member in package.xml. Retrieved components use the .forecastingSourceDefinition suffix in the forecastingSourceDefinitions folder.