---
schema_version: "1"
id: a99f49e347b58cfebe5cae17b5d0f6ff132edb4deb1a57791682f521ecda496b
title: ForecastingSourceDefinition
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_meta/meta_forecastingsourcedefinition.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_forecastingsourcedefinition.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 7be7b891d52743bc777ed88be21db411f84b8d05675adcd5bcc90fcf430a56a1
description: Represents the object, measure, date type, and hierarchy that a forecast uses to project sales.
---
# ForecastingSourceDefinition

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

![Important](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/images/icon_note_important.png)

#### Important

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.

## Parent Type

This type extends the [Metadata](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/metadata.htm "The base class for all metadata types. You can’t edit this object. A component is an instance of a metadata type.") metadata type and inherits its fullName field.

## File Suffix and Directory Location

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

## Version

ForecastingSourceDefinition components are available in API version 52.0 and later.

## Fields

<table class="featureTable sort_table" summary="">



          <thead class="thead sorted" align="left">
            <tr>
              <th class="featureTableHeader  " id="d535406e105">Field Name</th>

              <th class="featureTableHeader  " id="d535406e108">Field Type</th>

              <th class="featureTableHeader  " id="d535406e111">Description</th>

            </tr>

          </thead>

          <tbody class="tbody">
            <tr>
              <td class="entry" headers="d535406e105" data-title="Field Name"><span class="keyword parmname">categoryField</span></td>

              <td class="entry" headers="d535406e108" data-title="Field Type">string</td>

              <td class="entry" headers="d535406e111" data-title="Description">Name of the forecast category that is associated with the forecast type.
                Possible values are:<ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">Opportunity.ForecastCategoryName</samp></li>

                </ul>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d535406e105" data-title="Field Name"><span class="keyword parmname">dateField</span></td>

              <td class="entry" headers="d535406e108" data-title="Field Type">string</td>

              <td class="entry" headers="d535406e111" data-title="Description">Field that is used for the forecast type’s date type. For example, the
                <span class="keyword parmname">CloseDate</span> field on Opportunity is used for opportunity close
                date-based forecast types. Possible values are:<ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">Opportunity.CloseDate </samp></li>

                  <li class="li"><samp class="codeph nolang">OpportunityLineItem.ServiceDate</samp></li>

                  <li class="li"><samp class="codeph nolang">OpportunityLineItemSchedule.ScheduleDate</samp></li>

                </ul>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d535406e105" data-title="Field Name"><span class="keyword parmname">familyField</span></td>

              <td class="entry" headers="d535406e108" data-title="Field Type">string</td>

              <td class="entry" headers="d535406e111" data-title="Description">Use this field to group forecasts by product family. Possible values are:<ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">Product2.Family</samp></li>

                </ul>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d535406e105" data-title="Field Name"><span class="keyword parmname">masterLabel</span></td>

              <td class="entry" headers="d535406e108" data-title="Field Type">string</td>

              <td class="entry" headers="d535406e111" data-title="Description">Required. Controlling label for this forecasting source definition.</td>

            </tr>

            <tr>
              <td class="entry" headers="d535406e105" data-title="Field Name"><span class="keyword parmname">measureField</span></td>

              <td class="entry" headers="d535406e108" data-title="Field Type">string</td>

              <td class="entry" headers="d535406e111" data-title="Description">Field that is used for the forecast type’s measure. For example, the
                <span class="keyword parmname">Amount</span> field on Opportunity is associated with revenue-based
                forecast types. Possible values are*:<ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">Opportunity.Amount</samp></li>

                  <li class="li"><samp class="codeph nolang">Opportunity.<var class="keyword varname">Custom</var></samp></li>

                  <li class="li"><samp class="codeph nolang">Opportunity.TotalOpportunityQuantity</samp></li>

                  <li class="li"><samp class="codeph nolang">OpportunityLineItem.<var class="keyword varname">Custom</var></samp></li>

                  <li class="li"><samp class="codeph nolang">OpportunityLineItem.Quantity</samp></li>

                  <li class="li"><samp class="codeph nolang">OpportunityLineItem.TotalPrice</samp></li>

                  <li class="li"><samp class="codeph nolang">OpportunityLineItemSchedule.<var class="keyword varname">Custom</var></samp></li>

                  <li class="li"><samp class="codeph nolang">OpportunityLineItemSchedule.Quantity</samp></li>

                  <li class="li"><samp class="codeph nolang">OpportunityLineItemSchedule.Revenue</samp></li>

                  <li class="li"><samp class="codeph nolang">OpportunitySplit.<var class="keyword varname">Custom</var></samp></li>

                  <li class="li"><samp class="codeph nolang">OpportunitySplit.SplitAmount</samp></li>

                </ul>
                *Where <var class="keyword varname">Custom</var> represents the name of the custom field that a
                forecast type’s measure is based on. Example: Use <samp class="codeph nolang">Megawatts__c</samp> to forecast energy consumption.
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d535406e105" data-title="Field Name"><span class="keyword parmname">sourceObject</span></td>

              <td class="entry" headers="d535406e108" data-title="Field Type">string</td>

              <td class="entry" headers="d535406e111" data-title="Description">Required. Object associated with this forecasting source definition. Possible
                values are:<ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">Opportunity</samp></li>

                  <li class="li"><samp class="codeph nolang">OpportunityLineItem</samp></li>

                  <li class="li"><samp class="codeph nolang">OpportunityLineItemSchedule</samp></li>

                  <li class="li"><samp class="codeph nolang">OpportunitySplit</samp></li>

                  <li class="li"><samp class="codeph nolang">Product2</samp></li>

                </ul>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d535406e105" data-title="Field Name"><span class="keyword parmname">territory2Field</span></td>

              <td class="entry" headers="d535406e108" data-title="Field Type">string</td>

              <td class="entry" headers="d535406e111" data-title="Description">For a territory-based forecast type, indicates the field that is used for
                territory information. Possible values are:<ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">Opportunity.Territory2Id</samp></li>

                </ul>
                <p class="p">For user role-based forecast types, this value is <samp class="codeph nolang">null</samp>.</p>
              </td>

            </tr>

            <tr>
              <td class="entry" headers="d535406e105" data-title="Field Name"><span class="keyword parmname">userField</span></td>

              <td class="entry" headers="d535406e108" data-title="Field Type">string</td>

              <td class="entry" headers="d535406e111" data-title="Description">Specifies who owns the forecast. Possible values are:<ul class="ul bulletList">
                  <li class="li"><samp class="codeph nolang">Opportunity.OwnerId</samp></li>

                  <li class="li"><samp class="codeph nolang">OpportunitySplit.SplitOwnerId</samp></li>

                </ul>
              </td>

            </tr>

          </tbody>

        </table>

## Declarative Metadata Sample Definition

The following is an example of a ForecastingSourceDefinition component.

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

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

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types\>
        <members\>\*</members\>
        <name\>ForecastingSourceDefinition</name\>
    </types\>
    <version\>52.0</version\>
</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](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/file_based_zip_file.htm "The deploy() and retrieve() calls are used to deploy and retrieve a .zip file. Within the .zip file is a project manifest (package.xml) that lists what to retrieve or deploy, and one or more XML components that are organized into folders.").

## 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.