Predictive AI with CRM Analytics with Einstein Discovery, part 2

Laurens Wapenaar
December 19, 2024

In part 1 of this blog series, we introduced how Salesforce data combined with predictive AI can help mitigate the risks of failed payments with Salesforce AI solutions.

Our first approach used Salesforce Einstein Prediction Builder. In this second part, we walk through a solution using Salesforce CRM Analytics with Einstein Discovery. In the third and final part of this series, we will use Salesforce Data Cloud with Einstein Studio.

A brief recap – why use AI for failed payments?

With Salesforce CRM customer 360 and FinDock native payment data on Salesforce, you have real-time data that can help you address a common frustration – failed payments. Mitigating the risks to business and customer satisfaction caused by failed payments is challenging.

There are many potential causes for failed payments – expired cards, changed bank accounts, wrong collection date, and so on. This makes failed payments a great use case for predictive AI.

Your Salesforce CRM with FinDock has all this data that comes into play with a failed payment. With predictive AI, we can leverage that data to proactively mitigate the chances of payments failing.

Predicting failed payments with CRM Analytics and Einstein Discovery

Our first shot at AI-driven predictions used Einstein Prediction Builder. It’s a good option to get started, but the prediction model can only use data from one object, which limits our prediction potential.

To leverage more data in failed payment predictions we can use CRM Analytics and build the prediction model with Einstein Discovery. This approach allows you to use data from multiple objects which helps you build a strong prediction. You can also pull in data from outside Salesforce to further enrich the model. Let’s see how it works.

Before you start

  1. If you do not have payment data in your org, you can use the following script to insert some records. The script injects random processors and methods names. It does not take your actual FinDock configuration into account. (Data Inject Script)
  2. Check and make sure you have CRM Analytics enabled.

Step 1 – Set up data and permissions

We need to first tell Salesforce what we want to predict. This should be a simple data point, preferably expressed as a boolean. So, let’s create that and give our Analytics integration permission to access the source data on the Installment object. 

 

  1. Create a formula field “Failed” and add the formula:
    IF(ISPICKVAL(cpm__Status__c, ‘Failed’), True, False)
  2. Give the Analytics integration user access to all fields for the Installment object through the user profile for Analytics Cloud Integration.

Step 2 – Add data to CRM Analytics

To be able to create a model with Einstein Discovery, we need to first get our data into CRM Analytics. We’ll create a simple setup that just uses data from your org, but there is much more you can do, like integrate with Data Cloud.

 

  1. Create a dataset and name it “Installments.”
  1. Select all fields you want to use for the model (Yes really, individually one by one. Please upvote this ideaExchange item!) You can add more later, but make sure you select at least:
  • Payment Method
  • Payment Processor
  • Failed (our custom field from step 1)
  • Amount
  • Status
  1. Click Save.
  2. Check your work. The Data Flow should look like this when you open the Digest or Register boxes.
  1. Click Update DataFlow.
  2. Click Run DataFlow.
  1. Check whether the DataFlow has synced your records under Data Manager > Monitor, which you can access by the clicking Data Manager app title. Expand the Sync of cpm__Installment__c by clicking the chevron > and make sure some records were synced.

This is also where CRM Analytics improves upon the capabilities of Einstein Prediction Builder. By repeating steps 1-7, you can add more data points from or outside Salesforce that can later be used by your prediction model to predict failed payments.

Step 3 – Create your prediction model

With our CRM Analytics data ready, we can build a prediction model.

 

  1. Go to the main Analytics Studio app.
  2. Click Create > Model.
  1. Select Create from Dataset and click Continue.
  1. Search and select the Installments dataset we created earlier.
  2. Tell the model Minimize Failed = True.
  1. To keep the model clean, let’s exclude the Status column since the Failed boolean field is already based on that date. Select Manual configuration of Model Columns and click Next.
  1. Deselect Status as Salesforce rightfully indicates it will lead to data leakage.
  1. Select the algorithm you would like to use or leave the default and click Train Model.
  1. Wait for your model to complete the training…
  1. When Salesforce Einstein has trained your model, you can evaluate its performance. If you’d like to examine it in more detail, click View Model Evaluation.
  1. If you’re happy with the performance, click Deploy Model.
  2. Enter a Model Name and a Prediction Definition and click Next.
  1. Connect the model to the Installment object.
  1. Map model variables to the Installment object. As the model is based on a dataset with our object already, the default should be correct.
  1. Use the defaults for all the next steps for now and click Deploy.

Step 4 – Add predictions to records

Now let’s use our model’s prediction to score Installment records.

  1. Click Enable under Automated Prediction Writeback.
  1. Select Create a prediction field, name it “Chance to fail” and click Save.
  1. Go to the Salesforce Setup and give users permission to access the new Chance_to_fail__c field.
  2. Go to the Scoring Tab.
  3. Click Enable under Enable Scoring Writeback.
  1. Click Start Scoring.
  2. Click Continue.
  3. Wait until Status = Completed.

Now it’s time to start adding your predictions to existing payments (Installment records)!

This can be done in several ways. You can simply add the Chance to fail field to your record layouts, but you can also create a Screen Flow to show the prediction in a nice component, potentially with suggested follow-up actions.

  1. Create a Screen Flow that:

a. Gets the current installment.

b. Shows the Chance to fail in a Screen using text This installment has {!Get_Installments.Chance_to_fail__c}% chance to fail!

c. Save and activate your Flow.

  1. Add your Flow to the Installment layout and check Pass all field values from the record into this flow variable.
  1. Click Save.

Step 5 – Analyze results and build mitigation responses

Now check out your Installment to see if any future payments are at risk! 

CRM Analytics has a complete set of features to both manage your model, get more insights from your data and your models and even follow up on your predictions. For instance, you could:

  • Analyze your model’s Data Insights to see what factors impact your predictions the most and use those insights to design next best actions to mitigate failures
  • Create next best actions with Einstein NBA builder based on your insights.

Next steps

As we mentioned earlier, with CRM Analytics you can use other data sources in your prediction model. One option is to integrate with Data Cloud.

Up next

In the third and final part of this series, we will look at building an advanced predictive AI model with Salesforce Data Cloud and Einstein Studio.

Further reading