---
schema_version: "1"
id: 43f017759da7da03b1b6404d3510e323893bad0a7bee60ff76f181d6cfe17cf4
title: DiscoveryGoal
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/api_meta/meta_discoverygoal.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_discoverygoal.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 32c2fa5dbc8085d790153e522aee185c1fdfd7f4f3256fd3e45fcbc42db09360
description: Represents the metadata associated with an Einstein Discovery prediction definition.
---
# DiscoveryGoal

Represents the metadata associated with an Einstein Discovery prediction definition.

A prediction definition is a container object in Einstein Discovery that is associated with one or more deployed models. If a prediction definition contains multiple models, then each model produces predictions for a different segment of the data. A prediction definition can contain up to ten active models. In Package Manager, this type is listed as "Discovery Prediction".

## Declarative Metadata File Suffix and Directory Location

A DiscoveryGoal is stored in the discovery folder. DiscoveryGoals have a .goal file suffix. Here is a sample package.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types\>
        <members\>employees\_Tenure</members\>
        <name\>DiscoveryGoal</name\>
    </types\>
    <version\>53.0</version\>
</Package\>

## Version

DiscoveryGoals are available in API version 51.0 and later.

## Fields

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



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

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

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

            </tr>

          </thead>

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

              <td class="entry" headers="d388724e97" data-title="Field Type">boolean</td>

              <td class="entry" headers="d388724e100" data-title="Description">Indicates whether the prediction definition is active (True) or
                not (False).</td>

            </tr>

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

              <td class="entry" headers="d388724e97" data-title="Field Type">
                <a class="xref" href="#DiscoveryDeployedModel">DiscoveryDeployedModel</a>[]
              </td>

              <td class="entry" headers="d388724e100" data-title="Description">One or more deployed models associated with this prediction
                definition.</td>

            </tr>

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

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

              <td class="entry" headers="d388724e100" data-title="Description">Name of the prediction definition.</td>

            </tr>

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

              <td class="entry" headers="d388724e97" data-title="Field Type"><a class="xref" href="#DiscoveryModelCard">DiscoveryModelCard[]</a></td>

              <td class="entry" headers="d388724e100" data-title="Description">Model card for this prediction definition.</td>

            </tr>

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

              <td class="entry" headers="d388724e97" data-title="Field Type"><a class="xref" href="#DiscoveryGoalOutcome">DiscoveryGoalOutcome</a></td>

              <td class="entry" headers="d388724e100" data-title="Description">Outcome variable of this prediction definition.</td>

            </tr>

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

              <td class="entry" headers="d388724e97" data-title="Field Type"><a class="xref" href="#DiscoveryPredictionType">DiscoveryPredictionType</a></td>

              <td class="entry" headers="d388724e100" data-title="Description">Type of prediction: <span class="keyword parmname">Regression</span>,
                <span class="keyword parmname">Classification</span>, or
                <span class="keyword parmname">Unknown</span>.
              </td>

            </tr>

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

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

              <td class="entry" headers="d388724e100" data-title="Description">Automated writeback field for predictions. A custom field on the
                Salesforce object specified in
                <span class="keyword parmname">subscribedEntity</span>. <div class="box message info">
                  <div class="inner">
                    <div class="bd">
                      <div class="media">
                        <img class="img mtm" src="https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/images/icon_note.png" alt="Note">
                        <div class="mediaBd">
                          <h4 class="mbs">Note</h4>
                          <p>Removing a pushback
                            field from the goal metadata causes the field to be deleted from
                            the Salesforce object as well.</p>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </td>

            </tr>

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

              <td class="entry" headers="d388724e97" data-title="Field Type"><a class="xref" href="#DiscoveryPushbackType">DiscoveryPushbackType</a></td>

              <td class="entry" headers="d388724e100" data-title="Description">Type of writeback field for predictions.</td>

            </tr>

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

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

              <td class="entry" headers="d388724e100" data-title="Description">Salesforce object associated with this model.</td>

            </tr>

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

              <td class="entry" headers="d388724e97" data-title="Field Type">
                <a class="xref" href="#DiscoveryFilter">DiscoveryFilter</a>[]
              </td>

              <td class="entry" headers="d388724e100" data-title="Description">If specified, one or more filter expressions that define the
                conditions under which an observation has attained its terminal
                state (the actual outcome has been reached). For performance
                monitoring, Einstein Discovery determines model accuracy by
                comparing a model’s predicted outcomes with actual (observed)
                outcomes.</td>

            </tr>

          </tbody>

        </table>

## DiscoveryDeployedModel

Represents a model deployed in Salesforce.

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



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

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

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

            </tr>

          </thead>

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

              <td class="entry" headers="d388724e296" data-title="Field Type">boolean</td>

              <td class="entry" headers="d388724e299" data-title="Description">Indicates whether the deployed model is active (True) or inactive
                (False).</td>

            </tr>

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

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

              <td class="entry" headers="d388724e299" data-title="Description">Full name of the DiscoveryAIModel being deployed.</td>

            </tr>

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

              <td class="entry" headers="d388724e296" data-title="Field Type">double</td>

              <td class="entry" headers="d388724e299" data-title="Description">
                <p class="p">Threshold value. Applies only to binary classification models.
                  For regression models, this is null.</p>

              </td>

            </tr>

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

              <td class="entry" headers="d388724e296" data-title="Field Type">
                <a class="xref" href="#DiscoveryFieldMap">DiscoveryFieldMap</a>[]
              </td>

              <td class="entry" headers="d388724e299" data-title="Description">One or more mappings between model variables and either fields
                (in Salesforce objects) or columns (in CRM Analytics
                datasets).</td>

            </tr>

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

              <td class="entry" headers="d388724e296" data-title="Field Type">
                <a class="xref" href="#DiscoveryFilter">DiscoveryFilter</a>[]
              </td>

              <td class="entry" headers="d388724e299" data-title="Description">If specified, one or more segmentation filters for the deployed
                model. When making a prediction, the first model that has filters
                matching a specific input row will be used to make the prediction.
                No filters indicates that the model matches all input rows. </td>

            </tr>

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

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

              <td class="entry" headers="d388724e299" data-title="Description">Label for the deployed model. Appears in Model Manager.</td>

            </tr>

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

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

              <td class="entry" headers="d388724e299" data-title="Description">Name of the deployed model.</td>

            </tr>

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

              <td class="entry" headers="d388724e296" data-title="Field Type">
                <a class="xref" href="#DiscoveryPrescribableField">DiscoveryPrescribableField</a>[]
              </td>

              <td class="entry" headers="d388724e299" data-title="Description">Actionable fields associated with improvements.</td>

            </tr>

          </tbody>

        </table>

## DiscoveryFieldMap

Represents a mapping between model variables and field values.

| Field Name | Field Type | Description |
| --- | --- | --- |
| mappedField | string | Field in a Salesforce object or column in a CRM Analytics dataset. |
| modelField | string | Model variable. |
| sobjectFieldJoinKey | string | Join key for a Salesforce object. Null if sourceType is AnalyticsDatasetField. |
| source | string | If the mapping is to a CRM Analytics dataset, this is the name of the dataset. Otherwise, null. |
| sourceFieldJoinKey | string | If the mapping is to a CRM Analytics dataset, this is the lookup column on that dataset used to perform the join. Otherwise, null. |
| sourceType | [DiscoveryFieldMapSourceType](#DiscoveryFieldMapSourceType) | Data source type for field mapping. |

## DiscoveryFieldMapSourceType

Represents the data source type for field mapping: SalesforceField or AnalyticsDatasetField.

| Field Name | Field Type | Description |
| --- | --- | --- |
| SalesforceField | string | Field in a Salesforce object. |
| AnalyticsDatasetField | string | Column in a CRM Analytics dataset. |

## DiscoveryFilter

Represents a field filter.

| Field Name | Field Type | Description |
| --- | --- | --- |
| field | string | Name of the field to filter. |
| operator | DiscoveryFilterOperator | Operator used to calculate the filter. |
| type | [DiscoveryFilterFieldType](#DiscoveryFilterFieldType) | Type of filter value. |
| values | [DiscoveryFilterValue](#DiscoveryFilterValue)\[\] | One or more values selected for the filter. |

## DiscoveryFilterOperator

Represents a filter operator.

| Field Name | Field Type | Description |
| --- | --- | --- |
| Equal | string | Equal to operator (=). |
| NotEqual | string | Not equal to operator (<>). |
| GreaterThan | string | Greater than operator (>). |
| GreaterThanOrEqual | string | Greater than or equal to operator (>=). |
| LessThan | string | Less than operator (<). |
| LessThanOrEqual | string | Less than or equal to operator (<=). |
| Between | string | Between operator. |
| NotBetween | string | Not between operator. |
| InSet | string | In set operator. |
| NotIn | string | Not in operator. |
| Contains | string | Contains operator. |
| StartsWith | string | Starts with operator. |
| EndsWith | string | Ends with operator. |
| IsNull | string | Is null operator. |
| IsNotNull | string | Is not null operator. |

## DiscoveryFilterFieldType

Represents the data type of the filter field.

| Field Name | Field Type | Description |
| --- | --- | --- |
| Text | string | Text field type. |
| Number | string | Number field type. |
| Date | string | Date field type. |
| DateTime | string | Datetime field type. |
| Boolean | string | Boolean field type. |

## DiscoveryFilterValue

Represents a filter value.

| Field Name | Field Type | Description |
| --- | --- | --- |
| type | [DiscoveryFilterValueType](#DiscoveryFilterValueType) | Type of filter value. |
| value | [DiscoveryFilterValue](#DiscoveryFilterValue) | Value. |

## DiscoveryFilterValueType

Represents the type of filter value.

| Field Name | Field Type | Description |
| --- | --- | --- |
| Constant | string | Filter value is a constant. |
| PlaceHolder | string | Filter value is a placeholder. |

## DiscoveryPrescribableField

Represents custom improvement text.

| Field Name | Field Type | Description |
| --- | --- | --- |
| customDefinitions | [DiscoveryCustomPrescribableFieldDefinition](#DiscoveryCustomPrescribableFieldDefinition)\[\] | One or more strings for custom improvement text. Uses the default improvement text if none are specified. |
| name | string | Name of the model field that is actionable. |

## DiscoveryCustomPrescribableFieldDefinition

Represents a field definition in custom improvement text.

| Field Name | Field Type | Description |
| --- | --- | --- |
| filters | DiscoveryFilter\[\] | Represents one or more filters associated with custom improvement text. |
| template | string | If specified, represents the user-provided template from which the custom text is computed. If not specified, then the default text is used. |

## DiscoveryModelCard

Represents a model card associated with an Einstein Discovery prediction definition.

| Field Name | Field Type | Description |
| --- | --- | --- |
| contactEmail | string | Contact email for this model card. |
| contactName | string | Contact name for this model card. |
| label | string | Title for this model card. |
| sections | string | Sections in the model card. |

## DiscoveryGoalOutcome

Represents the outcome variable of the model.

| Field Name | Field Type | Description |
| --- | --- | --- |
| field | string | Name of the outcome variable. |
| fieldLabel | string | Label for the outcome variable. |
| goal | [DiscoveryOutcomeGoal](#DiscoveryOutcomeGoal) | Goal for the outcome variable. |
| mappedField | string | Mapped field. |

## DiscoveryOutcomeGoal

Represents the goal for an outcome.

| Field Name | Field Type | Description |
| --- | --- | --- |
| Minimize | string | Maximize the outcome. |
| Maximize | string | Minimize the outcome. |
| None | string | Reserved for future use. |

## DiscoveryPredictionType

Represents the prediction type for a model.

| Field Name | Field Type | Description |
| --- | --- | --- |
| Unknown | string | Unknown prediction type. |
| Regression | string | Regression prediction (numeric use case). |
| Classification | string | Binary classification prediction. |
| MulticlassClassification | string | Multiclass classification prediction. |

## DiscoveryPushbackType

Represents the type of writeback field. Must be set to AiRecordInsight.

| Field Name | Field Type | Description |
| --- | --- | --- |
| AiRecordInsight | string | Automatic writeback type. Required. |
| Direct | string | Currently not supported. Reserved for future use. |

## Declarative Metadata Sample Definitions

Here is a sample DiscoveryGoal:

<?xml version="1.0" encoding="UTF-8"?>
<DiscoveryGoal xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <active\>true</active\>
   <deployedModels\>
      <active\>true</active\>
      <aiModel\>Maximize\_Tenure</aiModel\>
      <fieldMappings\>
         <mappedField\>Opportunity.Amount</mappedField\>
         <modelField\>PTO</modelField\>
         <sourceType\>SalesforceField</sourceType\>
      </fieldMappings\>
      <fieldMappings\>
         <mappedField\>Opportunity.ExpectedRevenue</mappedField\>
         <modelField\>Salary</modelField\>
         <sourceType\>SalesforceField</sourceType\>
      </fieldMappings\>
      <fieldMappings\>
         <mappedField\>Level</mappedField\>
         <modelField\>Level</modelField\>
         <sobjectFieldJoinKey\>Opportunity.Name</sobjectFieldJoinKey\>
         <source\>employees</source\>
         <sourceFieldJoinKey\>Name</sourceFieldJoinKey\>
         <sourceType\>AnalyticsDatasetField</sourceType\>
      </fieldMappings\>
      <fieldMappings\>
         <mappedField\>Opportunity.StageName</mappedField\>
         <modelField\>Field</modelField\>
         <sourceType\>SalesforceField</sourceType\>
      </fieldMappings\>
      <filters\>
         <field\>Opportunity.StageName</field\>
         <operator\>Equal</operator\>
         <values\>
            <type\>Constant</type\>
            <value\>Qualification</value\>
         </values\>
      </filters\>
      <label\>employees</label\>
      <name\>employees</name\>
      <prescribableFields\>
         <customDefinitions\>
           <filters\>
              <field\>Salary</field\>
              <operator\>LessThan</operator\>
              <type\>Number</type\>
              <values\>
                 <type\>PlaceHolder</type\>
                 <value\>\[value\_low\]</value\>
              </values\>
           </filters\>
           <template\>Increase \[field\_name\] by \[diff\]</template\>
         </customDefinitions\>
         <customDefinitions\>
            <filters\>
               <field\>Salary</field\>
               <operator\>GreaterThan</operator\>
               <type\>Number</type\>
               <values\>
                   <type\>PlaceHolder</type\>
                   <value\>\[value\_low\]</value\>
                </values\>
             </filters\>
             <template xsi:nil="true"/>
          </customDefinitions\>
          <name\>Salary</name\>
      </prescribableFields\>
      <prescribableFields\>
          <customDefinitions\>
             <filters\>
                <field\>Level</field\>
                <operator\>LessThan</operator\>
                <type\>Number</type\>
                <values\>
                   <type\>PlaceHolder</type\>
                   <value\>\[value\_low\]</value\>
                </values\>
            </filters\>
            <template xsi:nil="true"/>
          </customDefinitions\>
          <customDefinitions\>
             <filters\>
                <field\>Level</field\>
                <operator\>GreaterThan</operator\>
                <type\>Number</type\>
                <values\>
                   <type\>PlaceHolder</type\>
                   <value\>\[value\_low\]</value\>
                 </values\>
              </filters\>
              <template xsi:nil="true"/>
          </customDefinitions\>
          <name\>Level</name\>
      </prescribableFields\>
      <prescribableFields\>
         <name\>Field</name\>
      </prescribableFields\>
   </deployedModels\>
   <label\>employees\_Tenure</label\>
   <outcome\>
      <field\>Tenure</field\>
      <fieldLabel\>Tenure</fieldLabel\>
      <goal\>Maximize</goal\>
      <mappedField\>Opportunity.Amount</mappedField\>
   </outcome\>
   <predictionType\>Regression</predictionType\>
   <pushbackField\>My\_Pushback\_Field\_\_c</pushbackField\>
   <subscribedEntity\>Opportunity</subscribedEntity\>
   <terminalStateFilters\>
      <field\>Opportunity.Amount</field\>
      <operator\>GreaterThan</operator\>
      <values\>
         <type\>Constant</type\>
         <value\>5</value\>
      </values\>
   </terminalStateFilters\>
   <terminalStateFilters\>
      <field\>Opportunity.Amount</field\>
      <operator\>LessThan</operator\>
      <values\>
         <type\>Constant</type\>
         <value\>10</value\>
      </values\>
   </terminalStateFilters\>
</DiscoveryGoal\>

## 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.264.0.api_meta.meta/api_meta/file_based_zip_file.htm).