Einstein Prediction Builder. The Artificial Intelligence by Salesforce

Einstein Prediction Builder. The Artificial Intelligence by Salesforce

Currently, on the IT projects market, it is hard to find a subject more sexy than Artificial Intelligence. The objective arguments considered, it is not surprising. AI (Artificial Intelligence) is the future that is happening right before our very eyes and will certainly induce major changes in many industries.

Salesforce as a CRM market leader is no exception and they have invested heavily in Einstein, i.e. the implementation of Artificial Intelligence on their platform. They do it on a very big scale and it would be difficult to describe all the functionalities in one article, so let’s look at the simplest, but at the same time incredibly effective and useful one – The Einstein Prediction Builder.


What makes Einstein Prediction Builder such an extraordinary accessible, flexible and useful tool?

  1. It is based on Machine Learning, that is, it uses historical data to determine the templates and principles contained in them, and then uses them to predict future results.
  2. Clicks, not code. A business user does not need to have any knowledge of writing code to be able to predict the future based on historical data from its own system. All you need to know is the Prediction Builder.
  3. Any user with administrator rights may build the so-called predictions on each object (both on standard and custom objects).
  4. Quick results – they are available after no more than 24 hours.
  5. The process of predicting future data may be a part of any Salesforce-based process or application (e.g., the set of actions performed in a given process may be dependent on the result of the prediction made).

As I have mentioned above, the results are predicted based on historical data – Prediction Builder requires at least 400 records to be able to make predictions. In the case of binary predictions (where the variable storing the prediction result may take only two, mutually exclusive values), the number of records is at least 100.

Before we go to technical details, let’s look at example cases Einstein Prediction Builder may be used in:


  • Which candidate for admission to college has the best chance of achieving outstanding results? Of course, the result obtained thanks to Prediction Builder should not be decisive in this case, but it gives the Recruitment Commission another tool for evaluation.
  • Which student is at high risk of dropping out of college? Having the answer to the question, you can implement an assistance plan for him/her.
  • What may be the final average of a student’s grades?


  • Which client is not going to turn out for a pre-booked dinner?


  • Which invoice, with high probability, is not going to be paid on time?


  • How many days is a given task/project to take?

Let’s take a closer look at the implementation of one of the above mentioned applications:

Which invoice, with high probability, is not going to be paid on time? The general plan may be outlined as follows:

1. Collect historical data for the given object

As I have mentioned above, Einstein creates predictions based on historical data. It is necessary to collect enough of them – the more data is available, the better predictions shall be.

2. Data preparation

Einstein Prediction Builder supports numeric data, logical data (so-called ‘checkbox data types’) and formula text fields that return TRUE, FALSE or NULL values. Therefore, if you want to use a different type of field (e.g. a picklist), you should support Prediction Builder by creating a formula that translates data other than the above categories into the logical values – true/false.


The ‘Invoice’ object has an ‘Invoice Status’ field accepting values:

  • Paid on Time
  • Pending
  • Late

To support Prediction Builder, we create a ‘formula’-type field on the ‘Invoice’ object returning a ‘checkbox’ data type result with the name ‘Late Payment’, based on the result of the following formula that returns ‘true’ when the invoice has expired and ‘false’ in other cases:


3. Activate Einstein and create a new prediction

Before we start working in a ‘fresh’ environment, we need to activate the Einstein Prediction Builder and then create a new prediction.

4. Determine segments/Filter the data

We do not always want to take into account all the records of a given object. For example, if we do have such knowledge, we may not take into account invoices from customers who have arranged for pre-authorised debits. In such a case, invoice payments always arrive on time, so they are not good material for ‘training’ Artificial Intelligence.

5. Select the field you want to predict the value of and the “sample” records to help Einstein in training

After preparing the data, you should provide Prediction Builder with learning material. In our example, you should use historical invoices with the statuses ‘Paid on Time’ and ‘Late’, omitting invoices which still have the status ‘Pending’. This is because we want to take into account only those invoices, which at the moment we can clearly define as delayed or paid.

6. Select the fields that should be taken into account for predictions

In most cases, the best option is to use all available fields. This is due to the fact that often we are not aware of the power that Artificial Intelligence may offer us, as it is able to find templates and patterns in seemingly insignificant data, adding great value to the final result of the prediction.

Another issue is the necessity to exclude certain fields for legal reasons (e.g. you may not make predictions based on fields determining gender, skin colour, religion) or due to the occurrence of specific loops and prediction distortions. (e.g. hindsight bias).

7. Create a field to store the prediction result

The prediction result must be stored in a specially created field. It will indicate the probability of occurrence of a given event – in our example, it will be the probability of delayed payment.

8. Start the Prediction Builder and wait for a result

At the end, there is nothing else to do but start Prediction Builder and wait for results. The maximum waiting time is 24 hours. For smaller data sets (e.g. 3 thousand records), this is usually about a few minutes.

9. The data is ready for presentation on the layout (e.g. using for the purpose of the salesforce component ‘List View’)

Are there any other functionalities apart from  Einstein Prediction Builder to provide the so-called “WOW effect”? Of course! Does the appearance of Einstein Discovery mean the end of the business analytics profession and from now on the managers are going to get the analysed data conveyed in business language, straight from Artificial Intelligence? Shall the Einstein Image Classification API make the commercial representative’s job disappear soon? Among other things, these are the topics we are going to address in subsequent articles.

* When creating the article, I made use of Salesforce materials.

Author: Paweł Niedziela, Director of Salesforce Technical Services in PolSource