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 the Metadata metadata type and inherits its fullName field.

File Suffix and Directory Location

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

Version

AIUsecaseDefinition components are available in API version 56.0 and later.

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

Field Name Description
aiUsecaseFieldMappings
Field Type
AIUsecaseFieldMapping[]
Description
The field mappings for the use case definition. Each use case definition can have multiple field mappings.
aiUsecaseModels
Field Type
AIUsecaseModel[]
Description
The models for the use case definition. Each use case definition can have multiple use case models.
creatorType
Field Type
CreatorType (enumeration of type string)
Description
Required.
The type of user who created the use case definition that's used by AI Accelerator. Valid values are:
  • INTERNAL_USER
  • SALESFORCE_ADMIN
Available in API version 57.0 and later.
masterLabel
Field Type
string
Description

Required.

A user-friendly name for the use case definition, which is defined when the use case definition is created.
maximumInsightCount
Field Type
int
Description
The maximum number of insights returned by the scoring response.
maximumRecommendationCount
Field Type
int
Description
The maximum number of recommendations returned by the Next Best Action Strategy.
maximumSuggestionCount
Field Type
int
Description
The maximum number of suggestions returned by the scoring response.
primaryResponseObject
Field Type
string
Description
The primary object in which the scoring response is stored based on the specified field mapping.
recommendationResponseObject
Field Type
string
Description
The recommendation response object associated with the use case definition.
recommendationSource
Field Type
RcmdSourceType (enumeration of type string)
Description
The tool or platform that generates recommendations. Valid values are:
  • Next_Best_Action_Flow
  • None
Available in API version 57.0 and later.
secondaryResponseObject
Field Type
string
Description
The object in which the scoring response is stored based on the specified field mapping.
shouldSaveFeatures
Field Type
boolean
Description
Indicates whether to save the features extracted for the scoring request (true) or not (false).
The default value is false.
shouldSaveInsights
Field Type
boolean
Description
Indicates whether to save the prediction insights that are used to generate the score (true) or not (false).
The default value is false.
shouldSaveRecommendation
Field Type
boolean
Description
Indicates whether to save the recommendation (true) or not (false).
The default value is false.
shouldSaveRequestResponse
Field Type
boolean
Description
Indicates whether to save the request response (true) or not (false).
The default value is false.
shouldSaveScore
Field Type
boolean
Description
Indicates whether to save the prediction score (true) or not (false).
The default value is false.
shouldSaveSuggestions
Field Type
boolean
Description
Indicates whether to save the suggestions for improving the prediction score (true) or not (false).
The default value is false.
suggestionImpactMinimumPct
Field Type
int
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
Field Type
string
Description

Required.

The name of the use case definition.

AIUsecaseFieldMapping

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

Field Name Description
developerName
Field Type
string
Description
The unique name for the field mapping in the use case definition.
Required. The unique name of the object in the API. This name can contain only underscores and alphanumeric characters, and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores. In managed packages, this field prevents naming conflicts on package installations. With this field, a developer can change the object’s name in a managed package and the changes are reflected in a subscriber’s organization. Label is Record Type Name.
mappedFieldName
Field Type
string
Description

Required.

The name of the field where the scoring response is stored.
mappedFieldType
Field Type
MappedFieldType (enumeration of type string)
Description

Required.

The type of the mapped field.

Valid values are:

  • FEATURE
  • PREDICTION_SCORE
  • INSIGHT
  • SUGGESTION
  • SECONDARY_RESPONSE_RECORD_ID
  • RECOMMENDATION_RESPONSE_RECORD_ID
  • RECOMMENDATION
The default value is FEATURE.
masterLabel
Field Type
string
Description

Required.

A user-friendly name for the use case field mapping, which is defined when the field mapping is created.
responseFieldName
Field Type
string
Description

Required.

The name of the response object’s field that’s mapped to the field storing the score.
responseObject
Field Type
string
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
Field Type
int
Description
The sequence number for the information stored in the field mapping.

AIUsecaseModel

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

Field Name Description
aiFeatureExtractors
Field Type
AIFeatureExtractor[]
Description
The AI feature extractors to retrieve the input data.
defaultFeatureExtractor
Field Type
AIFeatureExtractor
Description
The default AI feature extractor to retrieve the input data.
developerName
Field Type
string
Description
The unique name for the use case model.
Required. The unique name of the object in the API. This name can contain only underscores and alphanumeric characters, and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores. In managed packages, this field prevents naming conflicts on package installations. With this field, a developer can change the object’s name in a managed package and the changes are reflected in a subscriber’s organization. Label is Record Type Name.
masterLabel
Field Type
string
Description

Required.

A user-friendly name for the use case model, which is defined when the use case model is created.
predictionDefinition
Field Type
string
Description

Required.

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
Field Type
PredictionPlatform (enumeration of type string)
Description

Required.

The platform on which the machine learning model is created and deployed. Valid values are:
  • Einstein_Discovery
  • Default—For internal use only.
The default value is Einstein_Discovery. Available in API version 57.0 and later.

AIFeatureExtractor

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.

Field Name Description
batchInputSourceIdentifier
Field Type
string
Description
The identifier of the input source of the features computed by batch jobs, which can be used by a model for generating predictions. Available in API version 57.0 and later.
className
Field Type
string
Description

Required.

The ID of the Apex class created for the feature extractor.
developerName
Field Type
string
Description
The unique name for the feature extractor.
Required. The unique name of the object in the API. This name can contain only underscores and alphanumeric characters, and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores. In managed packages, this field prevents naming conflicts on package installations. With this field, a developer can change the object’s name in a managed package and the changes are reflected in a subscriber’s organization. Label is Record Type Name.
extractorType
Field Type
ExtractorType (enumeration of type string)
Description

Required.

The type of the feature extractor.

Valid values are:

  • APEX
  • JAVA
  • HYBRID
The default value is APEX.
featureInputType
Field Type
string
Description

Required.

The type of feature input that’s used in generating predictions. Valid values are:
  • Realtime_Input
  • Sample_Input
  • Batch_Input
  • Batch_And_Realtime_Input
Available in API version 57.0 and later.
inputContext
Field Type
string
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. Available in API version 57.0 and later.
masterLabel
Field Type
string
Description

Required.

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

Declarative Metadata Sample Definition

The following is an example of an AIUsecaseDefinition component.

<?xml version="1.0" encoding="UTF-8"?>
<AIUsecaseDefinition xmlns="http://soap.sforce.com/2006/04/metadata">
    <aiUsecaseFieldMappings>
        <developerName>DevName1</developerName>
        <mappedFieldName>Name</mappedFieldName>
        <mappedFieldType>INSIGHT</mappedFieldType>
        <masterLabel>DevName</masterLabel>
        <responseFieldName>AnnualRevenue</responseFieldName>
        <responseObject>Lead</responseObject>
        <sequenceNumber>2</sequenceNumber>
    </aiUsecaseFieldMappings>
    <aiUsecaseFieldMappings>
        <developerName>DevName2</developerName>
        <mappedFieldName>Value</mappedFieldName>
        <mappedFieldType>INSIGHT</mappedFieldType>
        <masterLabel>DevName</masterLabel>
        <responseFieldName>Id</responseFieldName>
        <responseObject>Account</responseObject>
        <sequenceNumber>2</sequenceNumber>
    </aiUsecaseFieldMappings>
    <aiUsecaseFieldMappings>
        <developerName>DevName3</developerName>
        <mappedFieldName>Score</mappedFieldName>
        <mappedFieldType>PREDICTION_SCORE</mappedFieldType>
        <masterLabel>DevName</masterLabel>
        <responseFieldName>Company</responseFieldName>
        <responseObject>Lead</responseObject>
    </aiUsecaseFieldMappings>
    <aiUsecaseFieldMappings>
        <developerName>DevName4</developerName>
        <mappedFieldName>RecordId</mappedFieldName>
        <mappedFieldType>SECONDARY_RESPONSE_RECORD_ID</mappedFieldType>
        <masterLabel>DevName</masterLabel>
        <responseFieldName>Address</responseFieldName>
        <responseObject>Lead</responseObject>
    </aiUsecaseFieldMappings>
    <aiUsecaseFieldMappings>
        <developerName>DevName1</developerName>
        <mappedFieldName>UsecaseModel1.inputScore</mappedFieldName>
        <mappedFieldType>PREDICTION_SCORE_INPUT</mappedFieldType>
        <masterLabel>DevName</masterLabel>
        <responseFieldName>Score</responseFieldName>
        <responseObject>LeadOutputDMO</responseObject>
        <joinFieldName>LeadId</sequenceNumber>
    </aiUsecaseFieldMappings>
    <aiUsecaseModels>
        <aiFeatureExtractors>
            <className>01pxx0000004X2CAAU</className>
            <extractorType>APEX</extractorType>
            <developerName>DevName2</developerName>
            <masterLabel>DevName</masterLabel>
            <featureInputType>Realtime_Input</featureInputType>
            <inputContext>"{columnNames=[column1, column2], rawData=[S, 315090]}"</inputContext>
            <batchInputSourceIdentifier>DatasetName</batchInputSourceIdentifier>
            <batchInputSourceType>CRMA</batchInputSourceType>
        </aiFeatureExtractors>
        <defaultFeatureExtractor>
            <className>01pxx0000004X0aAAE</className>
            <extractorType>APEX</extractorType>
            <developerName>DevName1</developerName>
            <masterLabel>DevName</masterLabel>
            <featureInputType>Realtime_Input</featureInputType>
            <inputContext>"{columnNames=[column1, column2], rawData=[S, 315090]}"</inputContext>
            <batchInputSourceIdentifier>DatasetName</batchInputSourceIdentifier>
        </defaultFeatureExtractor>
        <developerName>DevName1</developerName>
        <masterLabel>DevName</masterLabel>
        <predictionDefinition>PredictionDefinitionD</predictionDefinition>
        <predictionPlatform>Einstein_Discovery</predictionPlatform>
        <arePredctGenInRealTime>true</arePredctGenInRealTime>
    </aiUsecaseModels>
    <aiUsecaseModels>
        <developerName>DevName2</developerName>
        <masterLabel>DevName</masterLabel>
        <predictionDefinition>PredictionDefinitionBA</predictionDefinition>
        <predictionPlatform>Einstein_Discovery</predictionPlatform>
        <arePredctGenInRealTime>true</arePredctGenInRealTime>
    </aiUsecaseModels>
    <aiUsecaseModels>
        <developerName>DevName3</developerName>
        <masterLabel>DevName</masterLabel>
        <predictionDefinition>PredictionDefinitionCA</predictionDefinition>
        <predictionPlatform>Einstein_Discovery</predictionPlatform>
        <arePredctGenInRealTime>true</arePredctGenInRealTime>
    </aiUsecaseModels>
    <masterLabel>DevName</masterLabel>
    <maximumInsightCount>3</maximumInsightCount>
    <maximumSuggestionCount>3</maximumSuggestionCount>
    <maximumRecommendationCount>3</maximumRecommendationCount>
    <primaryResponseObject>Lead</primaryResponseObject>
    <secondaryResponseObject>Account</secondaryResponseObject>
    <recommendationResponseObject>Contact</recommendationResponseObject>
    <shouldSaveFeatures>true</shouldSaveFeatures>
    <shouldSaveInsights>true</shouldSaveInsights>
    <shouldSaveRecommendation>false</shouldSaveRecommendation>
    <shouldSaveRequestResponse>false</shouldSaveRequestResponse>
    <shouldSaveScore>true</shouldSaveScore>
    <shouldSaveSuggestions>true</shouldSaveSuggestions>
    <suggestionImpactMinimumPct>50</suggestionImpactMinimumPct>
    <usecaseName>FTestSampleMLUsecase</usecaseName>
    <recommendationSource>Next_Best_Action_Flow</recommendationSource>
    <creatorType>INTERNAL_USER</creatorType>
</AIUsecaseDefinition>

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>*AIUsecaseDefinition*</name>
    </types>
    <version>64.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.