Integrate Einstein Predictions Using Prediction Events

Einstein features, such as Prediction Builder, automatically write predicted values to AI prediction fields. Subscribe to the AIPredictionEvent platform event to capture these changes in a custom process that runs actions based on values Einstein predicts.

Where: This change applies to Lightning Experience and Salesforce Classic in Enterprise and Unlimited editions where Einstein features such as Prediction Builder or Case Classification are enabled.

How: When Einstein features write prediction results back to AI prediction fields, 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, use processes, Apex triggers, flows, or Streaming API to subscribe to AIPredictionEvent. Each time prediction results are written back to a Salesforce record, an AIPredictionEvent event is created and AIPredictionEvent subscribers are notified.

To capture changes made by Einstein predictions, create an event process that uses AIPredictionEvent as the event trigger. Add matching conditions, process criteria, and actions to match your use case. Here’s an example process that’s triggered by AIPredictionEvent messages. It reassigns Leads with high predicted score values.

Process Builder process using AIPredictionEvent as a trigger

If your process updates a field that is used by an Einstein prediction, Einstein runs the prediction again and writes back the new results. The new results generate a new AIPredictionEvent that could trigger your process again, resulting in a loop. To avoid creating a process loop, only update fields that aren’t used in Einstein predictions.