Build Intelligent Apps with the Salesforce Platform


As Salesforce Admins, building apps and custom workflows for your Salesforce users is like second nature, and it’s fun! We’ve seen so many super cool apps that leverage Lightning App Builder, Process Builder, Quick Actions, Lightning Components, and more to personalize the user experience and make it much more streamlined. However, users want not only their experiences personalized and streamlined but also to be intelligently guided throughout their workflows, reducing their own human error and supercharging their productivity.

With AI, users are in luck!

As of July 21, Einstein Prediction Builder (up to 10 enabled predictions) and Einstein Next Best Action (unlimited requests) are now included in Lightning Platform Plus SKU, at no extra cost. Additionally, Einstein Prediction Builder allows you to enable one free prediction for EE and above orgs, and Einstein Next Best Action allows up to 5,000 requests per org per month, regardless of the edition.

Now, you can combine these two products with the rest of the Salesforce Platform to build intelligent apps with ease. With Einstein Prediction Builder, you can build predictions on any custom object. With Einstein Next Best Action, you can deliver optimal recommendations by using strictly business rules, or combining them with insights or predictions created from products like Einstein Prediction Builder. Both of these products are built into the Salesforce Platform, leveraging Lightning Components, Flow, and more so you can embed the predictions and recommendations easily into custom workflows.

Let’s put this into the context of your business

Here are some examples of how businesses have created intelligent apps, leveraging Einstein Prediction Builder and Einstein Next Best Action to solve common challenges.

  1. Predicting customers who will pay late and engaging with empathy accordingly
  2. Predicting medical appointment no-shows and allocating resources accordingly
  3. Predicting when customers might churn and how to prevent it from happening
  4. Predicting the likelihood of a candidate being a good fit for a role and best steps to move forward
  5. Predicting the likelihood of projects being completed on time and how to make sure resources are working on the right ones

These use cases in action are simple. Let’s take use case #1 as an example.

The finance department will be able to see a list of their customers, with a prediction score created by Einstein Prediction Builder as a field in that list. This score shows the likelihood of whether a customer will pay late or not. The higher the score (in this case), the higher the likelihood the customer will pay late. By clicking on the customer records that have the higher scores, the Salesforce user will then see a Lightning Component embedded onto the record with the predicted score, as well as reasons showing why the score is what it is (e.g., customer’s business has slowed due to a pandemic). Under that Lightning Component, the user will see another Lightning Component showing recommendations on how to engage with this customer (e.g., engage with empathy and offer a discount or extension on payment). The recommendation will have an Accept/Reject button that, if a user accepts, will automate some process (e.g., sending an email to the customer) with Flow built on the backend of Einstein Next Best Action.

Setting up Einstein Prediction Builder

Getting started with Einstein Prediction Builder is easy. It’s a point & click wizard that will take you through a series of steps, asking you questions about your use case and your data. Here are the steps we recommend to get started:

Define your use case

Every machine learning (ML) initiative needs to start with what you already know, what you want to predict, and what you want to achieve. Fill out this worksheet to answer the right questions and help you form the predictive use case that’s best for your business.

Identify the data that supports your use case

Now it’s time to determine whether or not you have sufficient data to feed your model to answer the question you came up with in Step 1, so that your model can be trained appropriately and accurately. A simple rule of thumb for ML is if you can’t report on a question historically, you can’t predict it. To help you determine whether your data is sufficient to answer your question, our Einstein team has created what we call the Avocado Framework. ?

Going with the first use case (“Will a customer pay late?”), we will need examples of invoices that were paid late (the answer is yes, so we call them positive examples) and examples of invoices that were paid on time (the answer is no, so we call them negative examples). These records constitute the Example Set. Once Einstein Prediction Builder has been trained on those examples, it can then predict on records for which we don’t know the answer yet. These records are referred to as the Prediction Set.

Create your prediction

Now it’s time to get into the Einstein Prediction Builder wizard and build the prediction. Please refer to this guide (specifically, pages 17-25) to see a step-by-step. In this example, we’re only going to predict for invoices greater than $10,000.

Review, iterate, enable, and monitor your prediction

Congrats, you’ve built your prediction! Once your prediction is “Ready for Review,” click on the drop-down menu of your prediction and select View Scorecard. The scorecard gives you access to different metrics on your prediction. You can learn more about how to review the metrics of your scorecard in post.

Here are some questions to ask yourself while reviewing the scorecard of the predictive model, so you know whether to iterate on it before you enable the prediction:

  • Do the top predictors and the sign (positive or negative) for the correlation coefficients make sense based on your business knowledge?
  • Are there any potential data leakers in your model? In short, a data leaker is a piece of data that only shows up after the question you are trying to predict the answer to has already been answered.
  • Are there some fields that should be removed as they could introduce some bias?

Once you’ve enabled the prediction, it’s time to monitor it for a little while to make sure the predicted scores reflect what actually happens in practice.

An easy way to do this analysis is by using reports. This post provides step-by-step instructions on how to set those up. Below, you can see that for higher scores, most invoices ended up being paid late, while for lower scores, most were paid on time. For this, you want to see a large percentage of “False” in the lower scores and large percentages of “True” in the higher scores. This shows that our model is performing pretty well, according to what it says will happen!

Build the prediction into your business workflow

A prediction score is just a number. How do you actually take that number and put it into action for your business? Here are some examples:

  • Embed the Einstein Predictions Lightning Component (including the score with top predictive factors) onto record pages (note that you need the Einstein Predictions license to enable this feature).
  • Create list views of scores and sort in descending order, so users can prioritize records with the highest score.
  • Kick off a Flow or Process if a score reaches above or below a certain threshold.
  • Use Einstein Next Best Action to provide the right recommendations to any Salesforce user based on the prediction and your business rules.

Setting up Einstein Next Best Action

Einstein Next Best Action is a great logical step to put your predictions into action, or deliver recommendations using hard-and-fast business rules. Just like Einstein Prediction Builder, it’s extremely easy to set up.

Define your recommendations

In order to deploy recommendations to your Salesforce users, you first need to define which recommendations you want them to see. Recommendations is an object in Salesforce, where you can enter the name, description, acceptance & rejection labels, and which Lightning Flow you want to connect it to. Each recommendation, once accepted, can have a few steps automated (e.g., send an email, post JSON, ask a series of questions, etc.).

Create action strategies

Think of action strategies as the decisioning brain. Action strategies let you load all of your recommendations and constantly evaluate them based on your business rules to determine which ones to surface to your users.

Action strategies convey recommendations flowing from left to right, getting cut off as they move to the right along the branches, leaving only the ones that remain on the far right. Each element on the Strategy Builder is referred to as a node.

Inject intelligence into your action strategy

This is where you can bring in a prediction, like from Einstein Prediction Builder, to deploy recommendations based on the prediction score. You just create a new node; in this example of an attrition prediction, upsell recommendations will be deployed if the likelihood of attrition has a score lower than 20.

Display your recommendations

Now that you have defined your recommendations and set up your action strategy, you need to display the recommendations on the appropriate page. Recommendations can be embedded into any digital touchpoint: chatbots, community portals, webpages, backend systems, Salesforce objects and records, and mobile devices. In this case, we’re going to embed the recommendations on a Contact record page, using the Einstein Next Best Action Lightning Component.

Get started today

And there you have it! Two extremely easy-to-use low-code builders where you can guide your users, make them more productive, and eliminate human error. Even if you don’t have Lightning Platform Plus, you can enable up to one prediction per org in any EE and above license for Einstein Prediction Builder. For Einstein Next Best Action, every org has up to 5,000 requests available.

Get started today by heading to this trailmix!

How Salesforce Einstein Is Supercharging Mobile Experiences.

How Salesforce Einstein Is Supercharging Mobile Experiences

While its impact is widespread, one of the most exciting aspects of artificial intelligence (AI) is its ability to create conversational interactions that generate personalized experiences, supercharging productivity and efficiency. In this blog post, we’ll explore how the implementation of large language models on mobile devices is reshaping the enterprise mobile landscape and how Salesforce […]

Einstein standing next to text that says, "How to Use Generative AI Tools to Write SOQL Queries."

How to Use Generative AI Tools to Write SOQL Queries

Salesforce Object Query Language (SOQL) is a powerful tool that allows you to retrieve data from Salesforce. You can use SOQL to query any Salesforce object, including custom objects, custom fields, and user permissions like profile and permission set perms. As a Salesforce Admin, I know that writing SOQL queries can be a pain. Not […]