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

Parent Type 

This type extends Metadata and inherits its fields.

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 

active 

  • Type: boolean
  • Required: Yes
  • Description: Indicates whether the prediction definition is active (True) or not (False).

deployedModels 

  • Type: DiscoveryDeployedModel[]
  • Required: No
  • Description: One or more deployed models associated with this prediction definition.

label 

  • Type: string
  • Required: Yes
  • Description: Name of the prediction definition.

modelCards 

outcome 

  • Type: DiscoveryGoalOutcome
  • Required: Yes
  • Description: Outcome variable of this prediction definition.

predictionType 

pushbackField 

  • Type: string
  • Required: No
  • Description: 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 

subscribedEntity 

  • Type: string
  • Required: No
  • Description: Salesforce object associated with this model.

terminalStateFilters 

  • Type: DiscoveryFilter[]
  • Required: No
  • 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.

DiscoveryCustomPrescribableFieldDefinition Type 

Represents a field definition in custom improvement text.

Fields 

filters 

  • Type: DiscoveryFilter[]
  • Required: No
  • Description: Represents one or more filters associated with custom improvement text.

template 

  • Type: string
  • Required: No
  • Description: If specified, represents the user-provided template from which the custom text is computed. If not specified, then the default text is used.

DiscoveryDeployedModel Type 

Represents a model deployed in Salesforce.

Fields 

active 

  • Type: boolean
  • Required: Yes
  • Description: Indicates whether the deployed model is active (True) or inactive (False).

aiModel 

  • Type: string
  • Required: Yes
  • Description: Full name of the DiscoveryAIModel being deployed.

classificationThreshold 

  • Type: double
  • Required: No
  • Description: Threshold value. Applies only to binary classification models. For regression models, this is null.

fieldMappings 

  • Type: DiscoveryFieldMap[]
  • Required: No
  • Description: One or more mappings between model variables and either fields (in Salesforce objects) or columns (in CRM Analytics datasets).

filters 

  • Type: DiscoveryFilter[]
  • Required: No
  • 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.

label 

  • Type: string
  • Required: Yes
  • Description: Label for the deployed model. Appears in Model Manager.

name 

  • Type: string
  • Required: Yes
  • Description: Name of the deployed model.

prescribableFields 

DiscoveryFieldMap Type 

Represents a mapping between model variables and field values.

Fields 

mappedField 

  • Type: string
  • Required: Yes
  • Description: Field in a Salesforce object or column in a CRM Analytics dataset.

modelField 

  • Type: string
  • Required: Yes
  • Description: Model variable.

sobjectFieldJoinKey 

  • Type: string
  • Required: No
  • Description: Join key for a Salesforce object. Null if sourceType is AnalyticsDatasetField.

source 

  • Type: string
  • Required: No
  • Description: If the mapping is to a CRM Analytics dataset, this is the name of the dataset. Otherwise, null.

sourceFieldJoinKey 

  • Type: string
  • Required: No
  • Description: 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 Type 

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

DiscoveryFilter Type 

Represents a field filter.

Fields 

field 

  • Type: string
  • Required: Yes
  • Description: Name of the field to filter.

operator 

type 

values 

DiscoveryFilterFieldType Type 

Represents the data type of the filter field.

DiscoveryFilterOperator Type 

Represents a filter operator.

DiscoveryFilterValue Type 

Represents a filter value.

Fields 

type 

value 

  • Type: string
  • Required: Yes
  • Description: Value.

DiscoveryFilterValueType Type 

Represents the type of filter value.

DiscoveryGoalOutcome Type 

Represents the outcome variable of the model.

Fields 

field 

  • Type: string
  • Required: Yes
  • Description: Name of the outcome variable.

fieldLabel 

  • Type: string
  • Required: Yes
  • Description: Label for the outcome variable.

goal 

mappedField 

  • Type: string
  • Required: No
  • Description: Mapped field.

DiscoveryModelCard Type 

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

Fields 

contactEmail 

  • Type: string
  • Required: No
  • Description: Contact email for this model card.

contactName 

  • Type: string
  • Required: No
  • Description: Contact name for this model card.

label 

  • Type: string
  • Required: No
  • Description: Title for this model card.

sections 

  • Type: string
  • Required: No
  • Description: Sections in the model card.

DiscoveryOutcomeGoal Type 

Represents the goal for an outcome.

DiscoveryPredictionType Type 

Represents the prediction type for a model.

DiscoveryPrescribableField Type 

Represents custom improvement text.

Fields 

customDefinitions 

name 

  • Type: string
  • Required: Yes
  • Description: Name of the model field that is actionable.

DiscoveryPushbackType Type 

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

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.