AIPredictionEvent

Notifies subscribers when an Einstein feature, such as Prediction Builder or Case Classification, has written prediction results back to a target object and AI prediction field. This object is available in API version 46.0 and later.

Supported Calls

describeSObjects()

Supported Subscribers

Subscriber Supported?
Apex Triggers Yes
Flows Yes
Processes Yes
Pub/Sub API Yes
Streaming API (CometD) Yes

Subscription Channel

/event/AIPredictionEvent

Special Access Rules

Users with Customize Application permission have read access.

Event Delivery Allocation Enforced

No

Fields

Field Details
Confidence
Type
double
Properties
Nillable
Description
Relative confidence strength of the generated prediction result. Higher values (near 1.0) indicate stronger confidence.
EventUuid
Type
string
Properties
Nillable
Description
A universally unique identifier (UUID) that identifies a platform event message. This field is available in API version 52.0 and later.
FieldName
Type
string
Properties
Nillable
Description
API name of the AI prediction field that prediction results were written back to. An AI prediction field is a custom field created for storing and displaying the prediction scores on records. The name is specified in ObjectName.FieldName format, for example, Lead.predicted_score__c. For Case Classification prediction results, this field can be null.
HasError
Type
boolean
Properties
Defaulted on create
Description
true if there was an error while gathering information to create an event message, false otherwise.
InsightId
Type
string
Properties
Nillable
Description
The unique ID of the created AIRecordInsight record that generated the event message.
PredictionEntityId
Type
string
Properties
Nillable
Description
The unique ID of the created AIInsightValue record associated with the AIRecordInsight that generated the event message.
ReplayId
Type
string
Properties
Nillable
Description
Represents an ID value that is populated by the system and refers to the position of the event in the event stream. Replay ID values aren’t guaranteed to be contiguous for consecutive events. A subscriber can store a replay ID value and use it on resubscription to retrieve missed events that are within the retention window.
TargetId
Type
string
Properties
Nillable
Description
The unique ID of the record Einstein is writing prediction results to.

Usage

When Einstein writes prediction results back to AI prediction fields, record save custom logic, such as Apex triggers, workflow rules, and assignment rules, aren’t run for efficiency reasons. To add custom logic based on Einstein prediction results, subscribe to AIPredictionEvent for notifications of prediction result updates. Every time prediction results are written back to a Salesforce record, an AIPredictionEvent event is created and AIPredictionEvent subscribers are notified.