AIUsecaseDefinition

Represents a collection of fields in your Salesforce org used to define a machine learning use case and get real-time predictions.

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.

Important

Parent Type 

This type extends Metadata and inherits its fields.

File Suffix and Directory Location 

AIUsecaseDefinition components have the suffix .aiUsecaseDefinitions and are stored in the aiUsecaseDefinitions folder.

Version 

Introduced in API version 56.0.

Special Access Rules 

The AIUsecaseDefinition object is available when the admin settings for AI Accelerator and for the product related to the use case are enabled. The Salesforce org must have the CRM Plus license and the product’s CRM license.

Fields 

aiUsecaseFieldMappings 

  • Type: AIUsecaseFieldMapping[]
  • Required: No
  • Description: The field mappings for the use case definition. Each use case definition can have multiple field mappings.

aiUsecaseModels 

  • Type: AIUsecaseModel[]
  • Required: No
  • Description: The models for the use case definition. Each use case definition can have multiple use case models.

creatorType 

  • Type: CreatorType (enumeration of type string)
  • Required: Yes
  • Description: Required.

masterLabel 

  • Type: string

  • Required: Yes

  • Description: Required.

    A user-friendly name for the use case definition, which is defined when the use case definition is created.

maximumInsightCount 

  • Type: int
  • Required: No
  • Description: The maximum number of insights returned by the scoring response.

maximumRecommendationCount 

  • Type: int
  • Required: No
  • Description: The maximum number of recommendations returned by the Next Best Action Strategy.

maximumSuggestionCount 

  • Type: int
  • Required: No
  • Description: The maximum number of suggestions returned by the scoring response.

primaryResponseObject 

  • Type: string
  • Required: No
  • Description: The primary object in which the scoring response is stored based on the specified field mapping.

recommendationResponseObject 

  • Type: string
  • Required: No
  • Description: The recommendation response object associated with the use case definition.

recommendationSource 

  • Type: RcmdSourceType (enumeration of type string)
  • Required: No
  • Description: The tool or platform that generates recommendations. Available in API version 57.0 and later.
  • Possible values:
    • Next_Best_Action_Flow
    • None

secondaryResponseObject 

  • Type: string
  • Required: No
  • Description: The object in which the scoring response is stored based on the specified field mapping.

shouldSaveFeatures 

  • Type: boolean
  • Required: No
  • Description: Indicates whether to save the features extracted for the scoring request (true) or not (false).

shouldSaveInsights 

  • Type: boolean
  • Required: No
  • Description: Indicates whether to save the prediction insights that are used to generate the score (true) or not (false).

shouldSaveRecommendation 

  • Type: boolean
  • Required: No
  • Description: Indicates whether to save the recommendation (true) or not (false).

shouldSaveRequestResponse 

  • Type: boolean
  • Required: No
  • Description: Indicates whether to save the request response (true) or not (false).

shouldSaveScore 

  • Type: boolean
  • Required: No
  • Description: Indicates whether to save the prediction score (true) or not (false).

shouldSaveSuggestions 

  • Type: boolean
  • Required: No
  • Description: Indicates whether to save the suggestions for improving the prediction score (true) or not (false).

suggestionImpactMinimumPct 

  • Type: int
  • Required: No
  • Description: The minimum eligible percentage for improving the existing prediction score based on the suggestions. Suggestions with an impact greater than the specified percentage on the score are displayed on the prediction scorecard.

usecaseName 

  • Type: string

  • Required: Yes

  • Description: Required.

    The name of the use case definition.

AIFeatureExtractor Type 

Represents information about the feature extractor that’s used to retrieve the input data for the use case model that’s used to generate predictions.

Fields 

batchInputSourceIdentifier 

  • Type: string
  • Required: No
  • Introduced: API version 57.0
  • Description: The identifier of the input source of the features computed by batch jobs, which can be used by a model for generating predictions.

batchInputSourceInformation 

  • Type: string
  • Required: No
  • Introduced: API version 63.0
  • Description: The information about the batch input source, including query parameters, objects, field mappings, and filter criteria.

batchInputSourceType 

  • Type: BatchInputSourceType (enumeration of type string)
  • Required: No
  • Description: The input source of the features computed in batch jobs.

className 

  • Type: string

  • Required: No

  • Description: Required.

    The ID of the Apex class created for the feature extractor.

developerName 

  • Type: string
  • Required: Yes
  • Description: The unique name for the feature extractor.

extractorType 

  • Type: ExtractorType (enumeration of type string)

  • Required: Yes

  • Description: Required.

    The type of the feature extractor.

    The default value is APEX.

  • Possible values:

    • APEX
    • JAVA
    • HYBRID

featureInputType 

  • Type: FeatureInputType (enumeration of type string)

  • Required: Yes

  • Description: Required.

    The type of feature input that’s used in generating predictions. Available in API version 57.0 and later.

  • Possible values:

    • Realtime_Input
    • Sample_Input
    • Batch_Input
    • Batch_And_Realtime_Input

inputContext 

  • Type: string
  • Required: No
  • Introduced: API version 57.0
  • Description: The JSON file with features that act as context for the feature extractor. This data can also include the data in the uploaded CSV file.

masterLabel 

  • Type: string

  • Required: Yes

  • Description: Required.

    A user-friendly name for the feature extractor, which is defined when the feature extractor is created.

AIUsecaseFieldMapping Type 

Represents information about the field mapping to store extracted features, prediction scores, prediction insights, and use case suggestions in the response object.

Fields 

additionalFieldInformation 

  • Type: string
  • Required: No

customPredictionLabel 

  • Type: string
  • Required: No

developerName 

  • Type: string
  • Required: Yes
  • Description: The unique name for the field mapping in the use case definition.

joinFieldInformation 

  • Type: string
  • Required: No

mappedFieldName 

  • Type: string

  • Required: Yes

  • Description: Required.

    The name of the field where the scoring response is stored.

mappedFieldType 

  • Type: MappedFieldType (enumeration of type string)

  • Required: Yes

  • Description: Required.

    The type of the mapped field.

    The default value is FEATURE.

  • Possible values:

    • FEATURE
    • PREDICTION_SCORE
    • INSIGHT
    • SUGGESTION
    • SECONDARY_RESPONSE_RECORD_ID
    • RECOMMENDATION_RESPONSE_RECORD_ID
    • RECOMMENDATION

masterLabel 

  • Type: string

  • Required: Yes

  • Description: Required.

    A user-friendly name for the use case field mapping, which is defined when the field mapping is created.

responseFieldName 

  • Type: string

  • Required: Yes

  • Description: Required.

    The name of the response object’s field that’s mapped to the field storing the score.

responseObject 

  • Type: string

  • Required: Yes

  • Description: Required.

    The object whose field is mapped to the field storing the score. It’s either the PrimaryResponseObject or the SecondaryResponseObject specified in the AIUsecaseDefinition object.

sequenceNumber 

  • Type: int
  • Required: No
  • Description: The sequence number for the information stored in the field mapping.

AIUsecaseModel Type 

Represents information about the machine learning models that generate predictions for your use case.

Fields 

aiFeatureExtractors 

  • Type: AIFeatureExtractor[]
  • Required: No
  • Description: The AI feature extractors to retrieve the input data.

arePredctGenInRealTime 

  • Type: boolean
  • Required: Yes

defaultFeatureExtractor 

  • Type: AIFeatureExtractor
  • Required: No
  • Description: The default AI feature extractor to retrieve the input data.

developerName 

  • Type: string
  • Required: Yes
  • Description: The unique name for the use case model.

masterLabel 

  • Type: string

  • Required: Yes

  • Description: Required.

    A user-friendly name for the use case model, which is defined when the use case model is created.

predictionDefinition 

  • Type: string
  • Required: No
  • Description: The unique identifier of the prediction definition that’s related to the use case model. This identifier can be an external ID. If you use Einstein Discovery to create models, the predictionDefinition field stores the developer name of the record.

predictionPlatform 

  • Type: PredictionPlatform (enumeration of type string)

  • Required: Yes

  • Introduced: API version 57.0

  • Description: Required.

    The platform on which the machine learning model is created and deployed. The default value is Einstein_Discovery.

  • Possible values:

    • Data_Cloud
    • Default — For internal use only.
    • Einstein_Discovery
    • Einstein_on_Data_Cloud — Available in API version 63.0 and later.

Declarative Metadata Sample Definition 

The following is an example of an AIUsecaseDefinition component.

1<?xml version="1.0" encoding="UTF-8"?>
2<AIUsecaseDefinition xmlns="http://soap.sforce.com/2006/04/metadata">
3    <aiUsecaseFieldMappings>
4        <developerName>DevNamee1</developerName>
5        <mappedFieldName>Name</mappedFieldName>
6        <mappedFieldType>INSIGHT</mappedFieldType>
7        <masterLabel>DevName</masterLabel>
8        <responseFieldName>AnnualRevenue</responseFieldName>
9        <responseObject>Lead</responseObject>
10        <sequenceNumber>2</sequenceNumber>
11    </aiUsecaseFieldMappings>
12    <aiUsecaseFieldMappings>
13        <developerName>DevNamee2</developerName>
14        <mappedFieldName>Value</mappedFieldName>
15        <mappedFieldType>INSIGHT</mappedFieldType>
16        <masterLabel>DevName</masterLabel>
17        <responseFieldName>Id</responseFieldName>
18        <responseObject>Account</responseObject>
19        <sequenceNumber>2</sequenceNumber>
20    </aiUsecaseFieldMappings>
21    <aiUsecaseFieldMappings>
22        <developerName>DevNamee3</developerName>
23        <mappedFieldName>Score</mappedFieldName>
24        <mappedFieldType>PREDICTION_SCORE</mappedFieldType>
25        <masterLabel>DevName</masterLabel>
26        <responseFieldName>Company</responseFieldName>
27        <responseObject>Lead</responseObject>
28    </aiUsecaseFieldMappings>
29    <aiUsecaseFieldMappings>
30        <developerName>DevNamee4</developerName>
31        <mappedFieldName>RecordId</mappedFieldName>
32        <mappedFieldType>SECONDARY_RESPONSE_RECORD_ID</mappedFieldType>
33        <masterLabel>DevName</masterLabel>
34        <responseFieldName>Address</responseFieldName>
35        <responseObject>Lead</responseObject>
36        <joinFieldInformation>joinFieldInformation</joinFieldInformation>
37    </aiUsecaseFieldMappings>
38    <aiUsecaseFieldMappings>
39        <developerName>DevName5</developerName>
40        <mappedFieldName>DevName4</mappedFieldName>
41        <mappedFieldType>PREDICTION_SCORE_INPUT</mappedFieldType>
42        <masterLabel>DevName</masterLabel>
43        <responseFieldName>Address</responseFieldName>
44        <responseObject>Lead_Dmo</responseObject>
45        <joinFieldInformation>{"recordIdField":"Value2","recordIdObject":"Value1","recordJoinRelation":"Value3"}</joinFieldInformation>
46    </aiUsecaseFieldMappings>
47    <aiUsecaseFieldMappings>
48        <developerName>DevName6</developerName>
49        <mappedFieldName>DevName5</mappedFieldName>
50        <mappedFieldType>PREDICTION_SCORE_INPUT</mappedFieldType>
51        <masterLabel>DevName</masterLabel>
52        <responseFieldName>Address</responseFieldName>
53        <responseObject>Lead_Dmo</responseObject>
54        <joinFieldInformation>{"recordIdField":"Value2","recordIdObject":"Value1","recordJoinRelation":"Value3"}</joinFieldInformation>
55        <additionalFieldInformation>{"customPredictionAttributes":[{"id":1,"fieldLabel":"Label 1","sourceField":"Total_Spend_c__c"},{"id":2,"fieldLabel":"Label 2","sourceField":"Predicted_Churned2_recommendation_impact__c"}]}</additionalFieldInformation>
56        <customPredictionLabel>%%SCORE%%</customPredictionLabel>
57    </aiUsecaseFieldMappings>
58    <aiUsecaseModels>
59        <aiFeatureExtractors>
60            <className>01pxx0000004X2CAAU</className>
61            <extractorType>APEX</extractorType>
62            <developerName>DevNamee2</developerName>
63            <masterLabel>DevName</masterLabel>
64            <featureInputType>Realtime_Input</featureInputType>
65            <inputContext>"{columnNames=[column1, column2], rawData=[S, 315090]}"</inputContext>
66            <batchInputSourceIdentifier>DatasetName</batchInputSourceIdentifier>
67            <batchInputSourceType>CRMA</batchInputSourceType>
68            <batchInputSourceInformation>{"streamingTransformName":"SDT_Name","recordIdField":"fieldname","featureFieldsMapping":{"feature1":"field1","feature2":"field2"},"streaminTransformLabel":"SDT_Label","batchInputSourceLabel":"DMO_Label"}</batchInputSourceInformation>
69        </aiFeatureExtractors>
70        <defaultFeatureExtractor>
71            <className>01pxx0000004X0aAAE</className>
72            <extractorType>APEX</extractorType>
73            <developerName>DevNamee1</developerName>
74            <masterLabel>DevName</masterLabel>
75            <featureInputType>Realtime_Input</featureInputType>
76            <inputContext>"{columnNames=[column1, column2], rawData=[S, 315090]}"</inputContext>
77            <batchInputSourceIdentifier>DatasetName</batchInputSourceIdentifier>
78            <batchInputSourceType>CRMA</batchInputSourceType>
79            <batchInputSourceInformation>{"streamingTransformName":"SDT_Name","recordIdField":"fieldname","featureFieldsMapping":{"feature1":"field1","feature2":"field2"},"streaminTransformLabel":"SDT_Label","batchInputSourceLabel":"DMO_Label"}</batchInputSourceInformation>
80        </defaultFeatureExtractor>
81        <developerName>DevNamee1</developerName>
82        <masterLabel>DevName</masterLabel>
83        <predictionDefinition>PredictionDefinitionD</predictionDefinition>
84        <predictionPlatform>Einstein_Discovery</predictionPlatform>
85        <arePredctGenInRealTime>true</arePredctGenInRealTime>
86    </aiUsecaseModels>
87    <aiUsecaseModels>
88        <developerName>DevNamee2</developerName>
89        <masterLabel>DevName</masterLabel>
90        <predictionDefinition>PredictionDefinitionBA</predictionDefinition>
91        <predictionPlatform>Einstein_Discovery</predictionPlatform>
92        <arePredctGenInRealTime>true</arePredctGenInRealTime>
93    </aiUsecaseModels>
94    <aiUsecaseModels>
95        <developerName>DevNamee3</developerName>
96        <masterLabel>DevName</masterLabel>
97        <predictionDefinition>PredictionDefinitionCA</predictionDefinition>
98        <predictionPlatform>Einstein_Discovery</predictionPlatform>
99        <arePredctGenInRealTime>true</arePredctGenInRealTime>
100    </aiUsecaseModels>
101    <aiUsecaseModels>
102        <developerName>DevName4</developerName>
103        <masterLabel>DevName</masterLabel>
104        <predictionDefinition>Model1</predictionDefinition>
105        <predictionPlatform>Data_Cloud</predictionPlatform>
106        <arePredctGenInRealTime>false</arePredctGenInRealTime>
107    </aiUsecaseModels>
108    <aiUsecaseModels>
109        <developerName>DevName5</developerName>
110        <masterLabel>DevName</masterLabel>
111        <predictionDefinition>Model1</predictionDefinition>
112        <predictionPlatform>Einstein_on_Data_Cloud</predictionPlatform>
113        <arePredctGenInRealTime>false</arePredctGenInRealTime>
114    </aiUsecaseModels>
115    <masterLabel>DevName</masterLabel>
116    <maximumInsightCount>3</maximumInsightCount>
117    <maximumSuggestionCount>3</maximumSuggestionCount>
118    <maximumRecommendationCount>3</maximumRecommendationCount>
119    <primaryResponseObject>Lead</primaryResponseObject>
120    <secondaryResponseObject>Account</secondaryResponseObject>
121    <recommendationResponseObject>Contact</recommendationResponseObject>
122    <shouldSaveFeatures>true</shouldSaveFeatures>
123    <shouldSaveInsights>true</shouldSaveInsights>
124    <shouldSaveRecommendation>false</shouldSaveRecommendation>
125    <shouldSaveRequestResponse>false</shouldSaveRequestResponse>
126    <shouldSaveScore>true</shouldSaveScore>
127    <shouldSaveSuggestions>true</shouldSaveSuggestions>
128    <suggestionImpactMinimumPct>50</suggestionImpactMinimumPct>
129    <usecaseName>FTestSampleMLUsecase</usecaseName>
130    <recommendationSource>Next_Best_Action_Flow</recommendationSource>
131    <creatorType>INTERNAL_USER</creatorType>
132</AIUsecaseDefinition>

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

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