Create Einstein Prediction (ML Prediction Definition)
sf_create_einstein_predictionCreate an Einstein Prediction Builder definition to analyze historical Salesforce data and automatically score or classify records.
Instructions
Creates an Einstein Prediction Builder prediction definition (MLPredictionDefinition metadata type). Predictions analyze historical Salesforce data to score or classify records automatically.
predictionType:
BinaryClassification: predict a yes/no outcome (e.g. Will this opportunity close? Is this lead likely to convert?)
Regression: predict a numeric value (e.g. Expected revenue, likelihood score)
targetField: the field the prediction is based on (e.g. 'IsWon' for BinaryClassification on Opportunity) pushbackField: an existing custom field to write the prediction score to automatically
IMPORTANT: Einstein Prediction Builder requires an Einstein Analytics license or the Einstein Platform add-on. If the org lacks this license, the metadata deployment will succeed but the prediction cannot be trained or activated. This tool creates the definition — training happens in Setup → Einstein → Prediction Builder.
The prediction is created in Draft status. Activate it from Setup after training is complete.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| label | Yes | Prediction display label | |
| objectName | No | Alias for objectApiName | |
| description | No | Prediction description | |
| targetField | Yes | Field API name to predict, e.g. 'IsWon'. Deployed as <predictionField> together with objectApiName. | |
| negativeLabel | No | Label for negative outcome (BinaryClassification only) | No |
| objectApiName | No | Salesforce object to run predictions on, e.g. 'Opportunity' | |
| positiveLabel | No | Label for positive outcome (BinaryClassification only) | Yes |
| pushbackField | No | Field to write the prediction score to, e.g. 'Win_Score__c' | |
| predictionName | Yes | Prediction API name | |
| predictionType | Yes | BinaryClassification/Classification for yes/no, Regression for numeric | |
| aiApplicationDeveloperName | Yes | REQUIRED by Salesforce. API name of an existing AIApplication that owns this prediction — Einstein Prediction Builder creates one per app. The deploy fails with 'Required field is missing: aiApplicationDeveloperName' without it. |