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:
1<?xml version="1.0" encoding="UTF-8"?>
2<Package xmlns="http://soap.sforce.com/2006/04/metadata">
3    <types>
4        <members>employees_Tenure</members>
5        <name>DiscoveryGoal</name>
6    </types>
7    <version>53.0</version>
8</Package>

Version

DiscoveryGoals are available in API version 51.0 and later.

Fields

Field Name Field Type Description
active boolean Indicates whether the prediction definition is active (True) or not (False).
deployedModels DiscoveryDeployedModel[] One or more deployed models associated with this prediction definition.
label string Name of the prediction definition.
modelCards DiscoveryModelCard[] Model card for this prediction definition.
outcome DiscoveryGoalOutcome Outcome variable of this prediction definition.
predictionType DiscoveryPredictionType Type of prediction: Regression, Classification, or Unknown.
pushbackField string Automated writeback field for predictions. A custom field on the Salesforce object specified in subscribedEntity.

Removing a pushback field from the goal metadata causes the field to be deleted from the Salesforce object as well.

Note

pushbackType DiscoveryPushbackType Type of writeback field for predictions.
subscribedEntity string Salesforce object associated with this model.
terminalStateFilters DiscoveryFilter[] 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.

DiscoveryDeployedModel

Represents a model deployed in Salesforce.

Field Name Field Type Description
active boolean Indicates whether the deployed model is active (True) or inactive (False).
aiModel string Full name of the DiscoveryAIModel being deployed.
classificationThreshold double

Threshold value. Applies only to binary classification models. For regression models, this is null.

fieldMappings DiscoveryFieldMap[] One or more mappings between model variables and either fields (in Salesforce objects) or columns (in CRM Analytics datasets).
filters DiscoveryFilter[] 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.
label string Label for the deployed model. Appears in Model Manager.
name string Name of the deployed model.
prescribableFields DiscoveryPrescribableField[] Actionable fields associated with improvements.

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 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 Type of filter value.
values 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 Type of filter value.
value 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[] 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 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:
1<?xml version="1.0" encoding="UTF-8"?>
2<DiscoveryGoal xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3   <active>true</active>
4   <deployedModels>
5      <active>true</active>
6      <aiModel>Maximize_Tenure</aiModel>
7      <fieldMappings>
8         <mappedField>Opportunity.Amount</mappedField>
9         <modelField>PTO</modelField>
10         <sourceType>SalesforceField</sourceType>
11      </fieldMappings>
12      <fieldMappings>
13         <mappedField>Opportunity.ExpectedRevenue</mappedField>
14         <modelField>Salary</modelField>
15         <sourceType>SalesforceField</sourceType>
16      </fieldMappings>
17      <fieldMappings>
18         <mappedField>Level</mappedField>
19         <modelField>Level</modelField>
20         <sobjectFieldJoinKey>Opportunity.Name</sobjectFieldJoinKey>
21         <source>employees</source>
22         <sourceFieldJoinKey>Name</sourceFieldJoinKey>
23         <sourceType>AnalyticsDatasetField</sourceType>
24      </fieldMappings>
25      <fieldMappings>
26         <mappedField>Opportunity.StageName</mappedField>
27         <modelField>Field</modelField>
28         <sourceType>SalesforceField</sourceType>
29      </fieldMappings>
30      <filters>
31         <field>Opportunity.StageName</field>
32         <operator>Equal</operator>
33         <values>
34            <type>Constant</type>
35            <value>Qualification</value>
36         </values>
37      </filters>
38      <label>employees</label>
39      <name>employees</name>
40      <prescribableFields>
41         <customDefinitions>
42           <filters>
43              <field>Salary</field>
44              <operator>LessThan</operator>
45              <type>Number</type>
46              <values>
47                 <type>PlaceHolder</type>
48                 <value>[value_low]</value>
49              </values>
50           </filters>
51           <template>Increase [field_name] by [diff]</template>
52         </customDefinitions>
53         <customDefinitions>
54            <filters>
55               <field>Salary</field>
56               <operator>GreaterThan</operator>
57               <type>Number</type>
58               <values>
59                   <type>PlaceHolder</type>
60                   <value>[value_low]</value>
61                </values>
62             </filters>
63             <template xsi:nil="true"/>
64          </customDefinitions>
65          <name>Salary</name>
66      </prescribableFields>
67      <prescribableFields>
68          <customDefinitions>
69             <filters>
70                <field>Level</field>
71                <operator>LessThan</operator>
72                <type>Number</type>
73                <values>
74                   <type>PlaceHolder</type>
75                   <value>[value_low]</value>
76                </values>
77            </filters>
78            <template xsi:nil="true"/>
79          </customDefinitions>
80          <customDefinitions>
81             <filters>
82                <field>Level</field>
83                <operator>GreaterThan</operator>
84                <type>Number</type>
85                <values>
86                   <type>PlaceHolder</type>
87                   <value>[value_low]</value>
88                 </values>
89              </filters>
90              <template xsi:nil="true"/>
91          </customDefinitions>
92          <name>Level</name>
93      </prescribableFields>
94      <prescribableFields>
95         <name>Field</name>
96      </prescribableFields>
97   </deployedModels>
98   <label>employees_Tenure</label>
99   <outcome>
100      <field>Tenure</field>
101      <fieldLabel>Tenure</fieldLabel>
102      <goal>Maximize</goal>
103      <mappedField>Opportunity.Amount</mappedField>
104   </outcome>
105   <predictionType>Regression</predictionType>
106   <pushbackField>My_Pushback_Field__c</pushbackField>
107   <subscribedEntity>Opportunity</subscribedEntity>
108   <terminalStateFilters>
109      <field>Opportunity.Amount</field>
110      <operator>GreaterThan</operator>
111      <values>
112         <type>Constant</type>
113         <value>5</value>
114      </values>
115   </terminalStateFilters>
116   <terminalStateFilters>
117      <field>Opportunity.Amount</field>
118      <operator>LessThan</operator>
119      <values>
120         <type>Constant</type>
121         <value>10</value>
122      </values>
123   </terminalStateFilters>
124</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.