Bringing AI to Einstein Next Best Action with Einstein Discovery

Salesforce’s Einstein Next Best Action is a tool designed around giving quick, impactful recommendations to users, whether it be for closing a deal faster, lowering an account’s churn, or offering discounts to repeat customers. But how do you set up the best possible recommendations for all the unique deals and customers you have in your org? How do you harness the power of Einstein in a product that doesn’t have Einstein AI out of the box?

In this blog, we will cover different ways to use Einstein Discovery to take Einstein Next Best Action to the next level and deliver intelligent and customer- centered recommendations. The first way we will use Einstein Discovery is to take writeback prescriptions and build recommendations around those prescriptions, letting users read Einstein Discovery recommendations and immediately take action through a lightning flow. The following method covered will be around enhancing pre-existing recommendations based on Einstein Discovery scores along with other factors not included in the Discovery model. The last method we will cover uses Einstein Discovery to automatically generate all of your recommendations for you, allowing you to segment actions based on Discovery scores. 

Writeback Prescriptions

There are a couple of different ways to deploy and writeback to Salesforce Lightning. In this blog, we assume the user has already generated Einstein Discovery Stories in Einstein Analytics and is using Salesforce Lightning and not Salesforce Classic.

The first process of using Einstein Discovery with Next Best Action is to have Next Best Action read scores and prescriptions. This method requires writeback by displaying Einstein predictions using custom fields.

After installing the Einstein Discovery managed package, connect Discovery to your three custom fields for an outcome, explanation, and prescription. Add the Einstein Predictions to the target object record Lightning page and use a process builder or apex trigger to score records  The Lightning component and the three custom fields will now auto- populate with Einstein Discovery’s outcomes

Einstein Discovery’s prescriptive outcomes are based on the actionable variables defined when deploying the model in Einstein Analytics. Use those actionable variables to create recommendations within the Salesforce Recommendation object. For example, if the discount level is an actionable, one recommendation might be “increase discount level” with the lightning flow associated to the recommendation walking the user through questions about what percentage discount should be applied and sending an email to the account contact about their new discount.

In the Einstein Next Best Action strategy builder, load each recommendation. Next, add a filter node with the condition to be met relating to the Einstein Prescriptive custom field. In the example below, the condition reads $Record.Predicted_Churn_Prescription__c contains “change Support Level to Platinum.” 

Einstein Discovery’s writeback prescriptions

Connect the filter nodes to Output. Now, anytime Einstein Discovery thinks an account would benefit from changing the Support Level to Platinum, the user will see an Einstein Next Best Action lightning card offering Platinum Support for free or at a discount. This method of combining Einstein Discovery with Einstein Next Best Action is perfect for orgs not to use any Apex but still have AI-backed recommendations.

Predicted churn image 2

Enhance Recommendations

The next method for using Einstein Discovery with Einstein’s Next Best Action is to enhance our recommendations. In the last example, we covered offering a discount level or a new support level, but how do you help your users select the optimal discount level to maximize customer happiness and revenue? Start by deploying your Einstein Discovery model to Salesforce via the displaying Einstein predictions using custom fields or displaying Einstein predictions using automated prediction fields. The latter method creates a new field in Salesforce under the target object that just stores the score, so if the goal is to enhance recommendations with just score and not prescriptions, this method is best.

  1. The first step is to create your recommendations in the Salesforce Recommendation object. For a recommendation around offering a discount for a support level upgrade, write the recommendation description to something like “Offer Platinum Level Support” with a Lightning flow offering the user to select a discount percentage.

Next, create an apex class to write out the logic to segment discount recommendations based. For example, if the Einstein Discovery model predicted likelihood to churn for an account, and their outcome score is around 40% and they have been a customer for the last 3 years, we know this is an account that is savable and can use some logic like:

if(accounts[0].Predicted_Churn__c > 30 && accounts[0].Age__c >= 3){

r.Description = r.Description + ‘ with a 15% discount.’

}

This will result in the Einstein Next Best Action card to read “Offer Platinum Level Support with a 15% discount.” Now when the user selects to accept the recommendation and the discount selection picklist appears, they have a better idea of what level of discount to offer. 

To add the enhance apex class in the Einstein Next Best Action strategy builder, drag and drop the enhance node anywhere between a load note and the output node. In the Apex Action section, select the Apex class name you just created. Below that in the Argument section, type “$Record.Id” so that the apex class displays enhancements for the current record being viewed.

Predicted churn

Generating New Recommendations Automatically

The last method to use Einstein Discovery to power Einstein’s Next Best Action is to have Einstein Discovery outcome generate new recommendations automatically.

  1. Start by deploying your Einstein Discovery model to Salesforce via the displaying Einstein predictions using custom fields or displaying Einstein predictions using automated prediction fields. This method does not require any recommendations to be created in the Salesforce Recommendation object, but it does require a minimum of one Lightning flow.
  2. Next is creating an Apex class to generate all of the recommendations. Here we will define the logic for what recommendations appear and when. For example, if the Einstein Discovery story is predicting account likelihood to churn, actions for accounts with a 25% likelihood to churn might be different than an account with 75% likelihood to churn. Let’s say we only want to send an email to an account contact asking to simply connect about their opinions for a product if their predicted churn is >20% but schedule an onsite visit to discuss any problems they be having with a product or offer a deal negotiation for their next renewal in person if their predicted score is >60%. The logic might look like:
if(account.Predicted_Churn__c > 60){

Recommendation rec = new Recommednation(

Description = ‘The ‘ + account.Name + ‘ account has a likelihood to churn of  ‘ + account.Predicted_Churn__c + ‘%. Schedule an onsite meeting?’,

ActionReference = ‘OnsiteFlow’,

AcceptanceLabel = ‘Yes’

);

recs.add(rec);

}

else if(account.Predicted_Churn__c > 20){

Recommendation rec = new Recommednation(

Description = ‘The ‘ + account.Name + ‘ account has a likelihood to churn of  ‘ + account.Predicted_Churn__c + ‘%. Send product feedback survey?’,

ActionReference = ‘SurveyFlow’,

AcceptanceLabel = ‘Yes’

);

recs.add(rec);

}

The ActionReference in the above logic refers to the API name of the Lightning flow. 

In the Einstein Next Best Action strategy builder, you could simply drag the generate node onto the page and connect it to the output node. In the generate node, select the generate apex class just created under Apex Action. For the Argument, type “$Record.id” and click done. The Einstein Next Best Action Lightning card will not automatically populate with recommendations based on the logic defined in Apex class.

Summary

We hope this blog has helped you harness the power Einstein Discovery and given you ideas on how to take Einstein Next Best Action to the next level.  If you still have questions, drop us a line at info@SpringML.com or tweet us @springmlinc. 

Want More Information?

If you’d like additional Salesforce resources, check out these related SpringML resources: