Home Programming Architecting AI Solutions on Salesforce

Architecting AI Solutions on Salesforce

By Lars Malmqvist
books-svg-icon Book
eBook $32.99 $22.99
Print $39.99
Subscription $15.99 $10 p/m for three months
$10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
BUY NOW $10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
eBook $32.99 $22.99
Print $39.99
Subscription $15.99 $10 p/m for three months
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
  1. Free Chapter
    Chapter 1: AI Solutions on the Salesforce Einstein Platform
About this book
Written for Salesforce architects who want quickly implementable AI solutions for their business challenges, Architecting AI Solutions on Salesforce is a shortcut to understanding Salesforce Einstein’s full capabilities – and using them. To illustrate the full technical benefits of Salesforce’s own AI solutions and components, this book will take you through a case study of a fictional company beginning to adopt AI in its Salesforce ecosystem. As you progress, you'll learn how to configure and extend the out-of-the-box features on various Salesforce clouds, their pros, cons, and limitations. You'll also discover how to extend these features using on- and off-platform choices and how to make the best architectural choices when designing custom solutions. Later, you'll advance to integrating third-party AI services such as the Google Translation API, Microsoft Cognitive Services, and Amazon SageMaker on top of your existing solutions. This isn’t a beginners’ Salesforce book, but a comprehensive overview with practical examples that will also take you through key architectural decisions and trade-offs that may impact the design choices you make. By the end of this book, you'll be able to use Salesforce to design powerful tailor-made solutions for your customers with confidence.
Publication date:
November 2021
Publisher
Packt
Pages
340
ISBN
9781801076012

 

Chapter 1: AI Solutions on the Salesforce Einstein Platform

In this chapter, we will see why it is a good idea to build AI solutions on Salesforce and what business and technical benefits this approach can have. We will then take a bird's eye view of the various components that will be discussed throughout the book, present a basic architectural view of Salesforce Einstein, the AI platform embedded in Salesforce, and continue with a discussion on how architecting AI solutions is different from architecting traditional solutions.

This chapter ends by presenting Pickled Plastics Ltd., a scenario that will be expanded throughout the book to help reinforce the real-world applications of the technology.

In this chapter, we're going to cover the following main topics:

  • Why would you build AI solutions on Salesforce?
  • What are the main components of Salesforce AI?
  • What are the elements of Salesforce Einstein?
  • What's special about architecting for AI?
  • Presenting Pickled Plastics Ltd.

By the end of this chapter, you will know how to think about architecting AI solutions on Salesforce.

 

Technical requirements

There are no explicit technical requirements for this chapter, but you may find it useful to have an analytics-enabled developer org available to review points as we go through. This can be requested using the form here: https://developer.salesforce.com/promotions/orgs/analytics-de.

 

Why would you build AI solutions on Salesforce?

AI is at the heart of the Salesforce platform. There isn't a cloud or prominent feature today that doesn't have predictive or analytical capabilities available. Right now, you can build advanced AI solutions using clicks, not code, across most major Salesforce applications. To some extent, this is surprising. Salesforce is a relative latecomer to the world of AI.

The Einstein platform, which is Salesforce's collective name for its various AI and analytical features, did not exist until 2016. However, once it got going, the pace of evolution has been breathtaking. In 2016 alone, Salesforce acquired 10 companies, many of which were rolled into its AI capability.

In 2019, they acquired Tableau, an undisputed market leader in analytical software. Tableau CRM, the name given to the product combining Einstein Analytics and Tableau, is poised to become the de facto standard for analyzing CRM data. Even in academic AI research, Salesforce has become a force to be reckoned with, presenting groundbreaking research on natural language processing and computer vision. It is one of the first companies committed to a vision for responsible AI, encompassing the five trusted AI principles that AI should be responsible, accountable, transparent, empowering, and inclusive.

Overall, Salesforce has made an impressive commitment to including AI features across its product portfolio and doing so in a way that honors the platform by allowing extensive point-and-click-based configuration and more in-depth code-based customization. However, this begs a simple question: Why do I need AI capabilities in my CRM in the first place? Given the already extensive customization and configuration capabilities of Salesforce, do I need to complicate the picture with artificial intelligence (AI)? As you may guess from the fact that you're reading a book about these features, my answer is a resounding yes. In the next section, I will summarize why you need integrated AI features in your CRM platform.

The value of intelligent CRM data

For most large companies today, CRM is one of the vital arteries through which critical business data flows. Put bluntly, it is the system that knows about customers. The more we know about customers and the better we can use that knowledge to serve their needs, the better our businesses will do. If we learn more about customers, we can sell them products that better fit their needs at the exact time they need them. We can address their questions and concerns proactively both before and after purchase. Not least, we will be able to respond to changes in the market so that our products and services remain relevant over time.

These points have always been true, even before there was such a thing as CRM software. What CRM has enabled companies to do is track their relationship with customers in a way that far surpasses traditional methods. Similarly, an AI-enabled CRM far surpasses a conventional CRM in building and strengthening customer relationships over time.

The first important reason for that is the increasing complexity of the relationships that companies have with consumers. Today, you need to track interactions across digital and physical channels, in-store purchases, promotional events, social media, email campaigns, website visits, online orders, mobile notifications, and potentially a whole plethora of apps and dedicated digital experiences. Some of these may also have real-world components that may generate more relationship data, such as with wearable technology. This complexity means that it is increasingly difficult for a salesperson or customer support representative to look at the customer's profile and understand what is going on and what action is appropriate at a given point in time. They need help to make sense of the actual relationship and make the right decision when dealing with the customer.

Taking this up a level, complexity of relationships generates previously unseen levels of fast-moving data in various formats that do not necessarily respond well to traditional BI/reporting treatment. Managers and marketers, therefore, can no longer rely on the conventional way of analyzing and interpreting data. They need help to aggregate, simplify, and make actionable the treasure trove of behavioral insights found in customer data. The ability to precisely target consumers and interact with them in a genuinely personalized way is at the core of why you need AI in your CRM.

On a more practical level, AI allows the automation of a wide range of traditional CRM tasks, freeing up resources to help make use of the new opportunities generated by complex and varied data. Use cases such as automated report generation, data cleanup, quality management, handling simple sales, and service requests through automated channels (such as chatbots and automating routine process steps via RPA-like technologies) all offer immediate efficiencies.

While, in theory, these technologies need not sit inside the CRM, a native capability that enables you to gain access to these tremendous benefits easily is, in most cases, a no-brainer. With a native capability, you do not have to move data around, transform it, or manage yet another set of complex integrations. You can build on your existing team's skill sets rather than have to learn entirely new technologies and limit off-platform choices to only the areas where you can make a genuine business case.

Some examples

While the Einstein platform is relatively new compared to the Salesforce platform, it has been around for long enough that we can have a look at a few cases where these benefits have been realized.

U.S. Bank is the fifth-largest bank in the United States, with 73,000 employees. They are a long-term user of Salesforce and also an early adopter of the Einstein platform. They adopted the Einstein platform's predictive capabilities across several functions within the bank, explicitly to address the issues of fast-moving and varied relationship data. By increasing the volume and quality of their data, they can see patterns that they wouldn't have been able to identify manually.

This information is brought to the front line by adding predictive analytical capabilities to the interface seen by front-line officers, enabling them to make better sense of the relationship and make the right decision with the customer. 

Accenture is the largest IT services company in the world, with more than 500,000 employees. Within the company's CRM, the Einstein platform is used to visualize and predict information relevant to winning more deals. By embedding Einstein capabilities into lightning components shown in the relevant part of the CRM, users get highly relevant and accurate information that helps them clarify the steps to take for a given opportunity and a prediction of the current win rate.

Stonewall Kitchen is a US-based specialty food company with wholesalers across 42 countries and its stores in the US. From an AI perspective, Stonewall Kitchen has gone all-in on personalizing the online retail experience. Based on the Einstein platform, they have developed a product recommendation engine that is so good that 78% of customers who get a recommendation end up adding that recommendation to their cart, and 41% go on to buy. From an e-commerce perspective, these are awe-inspiring numbers.

These are just a few examples of how different companies have leveraged the Einstein platform to improve their ability to engage with customers and serve them better. These examples, however, are just the beginning. As a relatively young platform under constant development, we can expect genuinely great solutions to come to light in the future. Maybe after reading this book, you will work on some of them. Having gained an understanding of why using the Salesforce Einstein platform may be a good idea, we will now continue to look at the components that make up the platform.

 

What are the main components of Salesforce AI?

The most important fact about the Einstein platform is that while it is an entity in its own right, it is also an integral part of the complete Salesforce platform. That means, first and foremost, that the core CRM data model that powers the rest of the Salesforce feature set is directly available to the Einstein platform's AI features. That also means that the core security model, user interface, administrative functions, and so forth that make up the Salesforce CRM can be used by and straightforwardly use the Einstein features. This fact is crucial to maximizing the benefit of working on CRM instead of integrating third-party solutions. The following diagram gives an overview of the platform architecture:

Figure 1.1 – Einstein platform architecture

Figure 1.1 – Einstein platform architecture

The architecture diagram starts at the bottom level, with programmatic services that require advanced programming skills to implement, and proceeds up the stack to the pre-built solutions, which can be activated at the click of a button.

The Platform Services layer

The Platform Services layer, sometimes referred to as myEinstein, is the part of the Einstein platform that directly builds on top of the core data model to provide customizable capabilities for prediction and analysis. Overall, in keeping with the Salesforce platform, these can be divided into declarative services that you can configure via the administrative user interface and platform services that enable programmatic access to the platform:

  • In the first category, we find, for instance, Einstein Prediction Builder, a point-and-click interface for making predictions about the value of fields on CRM records. This feature has extensive configurability and allows substantial tweaking of what data is used for prediction and how the system will evaluate the prediction. This feature can be maintained administratively and does not require a data scientist or a developer to implement it.
  • In the second category, we find, for instance, the Einstein Vision feature. Einstein Vision is a programmatic API-based deep learning model that you can train for your particular use cases. For example, you could train a model to detect instances of your brand imagery in visual imagery. This feature requires considerable programming skills and machine learning knowledge to implement well.

Tableau CRM (previously called Einstein Analytics)

The analytics capabilities of Tableau CRM are prodigious, and they make use of many of the Einstein platform features that are discussed in this book. When considering the Einstein platform, this is often seen resting as a separate layer on top of the services layer. It is, however, well outside the scope of this book to go into any detail about this area. It deserves a large volume of its own. It is also principally focused on analyzing data to gain insight rather than using it for the types of AI-centric use cases we will be considering. Some of the pre-built solutions that we will learn about have analytics elements in them, but we will cover the specifics as and when required in these cases.

The Lightning Platform

The Lightning Platform in and of itself does not have any AI capabilities. However, you can't meaningfully operationalize the other features without them, so it deserves a mention in the overall architecture. Typically, you might bring in the predictive capability in the UI, for instance, as a field on a record that is set based on a machine learning model, or in a more elaborate scenario as a custom component, visualizing the information in a way that is particularly relevant to the context record.

However, in many cases, you may want to use the AI features directly in automation, such as a flow or process builder. A simple example might be a model that classifies incoming support cases based on which might likely escalate. If that probability is above a certain threshold, automation might alert relevant managers and assign the case to a special queue for velvet-glove treatment.

Einstein products

The last and increasingly largest category of features is found within specific Einstein products. These are prepackaged AI and analytics offerings that address particular use cases in particular clouds. It is more the rule than the exception for a Salesforce cloud to have a dedicated Einstein product offering, although some are better developed than others. There are many of these, they vary wildly, and more are added at a rapid clip release after release.

We will be going through many of these in later chapters, so we do not need to labor the point here. These solutions are, broadly speaking, less configurable than the Platform Services, but they are the obvious place to start if they fit your use case.

Third-party options

While it is generally advisable to use the platform options whenever possible, sometimes you reach a point where they do not offer the functionality you require. In those cases, you have two options:

  • First, you can look at AppExchange and see if someone has created a pre-built app for you to utilize.
  • Second, you can integrate third-party APIs into your solution. We will examine three options for this in Chapter 8, Integrating Third-Party AI Services, and give detailed guidance on when it is appropriate to go down that route. However, you should go down this route only when there is a much stronger fit for your requirements from going off-platform than staying on it.

With this foundation in place, let's move on to looking at the platform's various components in detail.

 

What are the elements of Salesforce Einstein?

This section will serve as a crash course in the various elements of the Einstein platform. It also serves as a handy reference for the content that will be coming in future chapters. All the features shown in the following diagram will be elaborated on further on in the book.

The chapters are standalone, so if anything catches your fancy, feel free to skip ahead to that section. I do, however, recommend that you take the time to finish this introductory chapter, as it sets the scene for the rest of the book.

Figure 1.2 – An overview of Einstein elements

Figure 1.2 – An overview of Einstein elements

We will start by considering the components of the Einstein platform related to sales.

Einstein for sales

Sales are the first use case that springs to mind when you think of Salesforce. It is, therefore, not surprising that this is an area with a strong AI offering as well. The following sections will introduce you to the various elements in play.

Einstein Lead and Opportunity Scoring

With Einstein Lead and Opportunity Scoring, you get an out-of-the-box way to apply AI to filter leads and opportunities within your CRM so that you can focus on the most likely to succeed and not waste scarce sales resources. Practically, that means each lead or opportunity is assigned a numeric score that indicates their attractiveness. Attractiveness in this context implies the likelihood that it will convert from a lead to an opportunity and from an opportunity to a sale.

While each model used for scoring is unique to the specific customer, the underlying model framework is fully automated. Salesforce automatically builds the model based on the data available in the lead and opportunity objects. You have minimal control over how this model is built, but you can use the score for various additional automated purposes. That might include alerting relevant people when a score crosses some threshold, automatically subscribing leads to a given customer journey in Marketing Cloud based on their lead score, or automatically stopping and archiving records where the score drops too low.

Einstein Forecasting

The need to increase forecast accuracy is near-universal. Very few organizations get their forecasts consistently correct. It is, therefore, not surprising that Salesforce has included an automated forecasting capability in Sales Cloud Einstein. Much like lead and opportunity scoring, Einstein Forecasting automatically analyzes data in individual Sales Cloud objects, mainly Opportunity but also others, and generates a set of predictive models to explain the outcomes.

Based on the best model, it generates several dashboards where you can see the forecast broken down by teams, with a confidence interval and information about key factors influencing the forecast. You can also see trend information based on the forecast and Einstein's prediction of future developments.

Einstein Activity Capture

Einstein Activity Capture is a way to automate some of the drudgery involved in matching emails and calendar events to Salesforce contacts and accounts. Once installed, it automatically matches emails and calendar events in your email client to existing accounts and contacts, saving you a considerable headache.

The synchronization details and how fields are mapped across can be a little tricky, but it's well worth it for the reduced manual work. Architecturally, it is also slightly different from most Salesforce offerings in that it stores information in a public cloud rather than on Salesforce itself. This has implications both for how you can use the data and for compliance.

Einstein Conversation Insights

Einstein Conversation Insights is one of the most exciting offerings in the Sales Cloud suite. It offers part-automated sales coaching via AI to improve the efficiency of sales teams. The critical ability is for AI to identify key moments within a conversation, such as the mention of a product or a competitor brand. Managers can then review this moment directly without the need to revisit the entire conversation.

That capability allows sales coaches and managers to handle a much higher volume of calls and substantially improve the feedback given to sales staff. The product also allows for analytics on top of the voice call data to see aggregate information about calls over time. Technically speaking, this is a bit more difficult to set up as it requires integrated telephony to be viable. However, there are many good options for doing this, including both native and third-party solutions.

Einstein for Service

Service is almost as commonly used on the Salesforce platform as Sales. The Service AI offering has many unique and interesting features that can help you enrich your solutions. In the following sections, we will explore how.

Einstein Bots

Chatbots are becoming ubiquitous as a channel for both sales and service. It is, therefore, not surprising that Salesforce has introduced its own bot framework directly within the Einstein platform. That means you now have the capability of building bots and exposing them via Salesforce chat, external websites, or social media channels.

The bot learns by example using natural language programming, which is to say that you define the limits of the dialogue that the bot will be able to participate in and the actions it will be able to take, but that you need to provide a certain amount of input for it to be effective. You can create chatbots without Einstein. However, it will not be able to make any kind of inferential leap. Bots can undertake a wide variety of actions on your behalf and can also escalate to a human operator if they get confused.

Einstein Case Classification and Routing

One of the most common activities within any Service Cloud implementation is working out ways to effectively route cases to the right people at the right time. Salesforce has a variety of options to deal with this area, depending on the level of complexity. Now one of them comes with AI.

Einstein Case Classification and Routing is a pre-built feature that allows easy creation of a machine learning model that enables predicting certain case fields based on other information in that record. Effectively, this will allow you to set the value of pick lists and checkboxes based on the model's best guess derived from historical data. This, in turn, will enable you to route cases based on that information using the usual methods. Thereby, companies can save the manual effort in the call center spent on classifying incomplete records.

Einstein Article Recommendations

Einstein Article Recommendations is another feature that focuses on eliminating drudgery. Searching through the knowledge base and attaching relevant articles to a case is one of the most common parts of the customer service agent's day job. The purpose of article recommendations is to partially automate this by Einstein automatically searching for similar cases and relevant articles and suggesting them directly without the need for agent interaction.

It works by building a machine learning model on top of the case object and the knowledge object. You have the option of telling it what fields to learn from and what fields are more important than others, and once this is done, agents will start seeing improved article recommendations that they can simply accept to have them tied to the case.

Einstein Reply Recommendations

Many chat interactions are quite repetitive, and Einstein Reply Recommendations leverage this fact to generate automatic reply options for customer service agents that they can use to help make chat interactions faster and more effective. Once activated and trained, the reply recommendations mode suggests replies in real time based on the current state conversation. Agents can either post these directly or edit them before posting.

Replies are generated using an advanced deep learning-based natural language processing model customized using historical data from past chats. It can, therefore, only be used where a substantial amount of historical data exists.

Einstein for Marketing

Marketing Cloud is arguably the leading digital marketing platform on the planet. The need to precisely target audiences with the right message at the right time is one that positively begs for an AI approach. We'll explore how Salesforce has risen to this challenge in the following sections.

Einstein Engagement Scoring

Einstein Engagement Scoring is a deceptively simple feature that uses a pre-built machine learning model to segment your subscribers based on their tendency to engage with the content you send out. The model is fully out of the box, but you have relatively wide opportunities for using it in your unique marketing scenario. Based on the engagement score assigned to subscribers, they are segmented into one of four groups:

  • Loyalists: The best kind of subscribers. They frequently open your emails and click on the links.
  • Window Shoppers: These subscribers open emails but have low click engagement.
  • Selective Subscribers: Choosy subscribers, have a low open rate, but if they open, they often also click through.
  • Winback/Dormant: Subscribers with both a low open rate as well as a low click engagement.

You can use these groups for specially targeted promotions with all your favorite Marketing Cloud tools. In particular, you can use these personas with the Einstein Split mechanism in Journey Builder to send different types of subscribers on different customer journeys automatically.

Einstein Recommendations

Einstein Recommendations is a feature that helps you by suggesting the most relevant next bit of content to share with a customer either through email or on the web. The feature automatically analyzes behavioral and affinity data related to customers and feeds this to a recommendation engine that you can use to produce personalized recommendations.

It relies on product or catalog data within Marketing Cloud, a prerequisite that not all users will have in place. It is also somewhat more heavyweight in configuration terms than most Einstein features we will be looking at. Once set up, however, it can be used directly within the Marketing Cloud Personalization Builder or Content Builder by using the pre-built recommendations component. That makes it very easy to deploy once the configuration has been completed.

Einstein Content Selection

When using Einstein Content Selection, email marketers can automatically customize their emails using configured business rules to maximize the click-to-open rate. Content is dynamically selected from a preexisting pool based on the underlying machine learning model's predictions and automatically tested using A/B testing to optimize even more. This allows email marketers to include the relevant component in an email template and have the AI do the rest.

Fundamentally, content selection works based on three factors:

  • Customer profile
  • Business rules
  • Content pool

That is to say, given preconfigured business rules, a set of subscribers to send to, and a pool of content to choose from, Einstein Content Selection will try to optimally pick the most relevant piece of content on a subscriber basis. The business rules give a relatively strong element of configurability to this feature. However, as with most of the pre-built Einstein features, you have no control over the underlying model.

Einstein Splits

Einstein Splits allows you to tailor your user journeys based on AI-generated personas and other factors to give truly customized experiences for your users. Various kinds of splits can be configured to tailor the path taken by particular kinds of users, selected by machine learning models based on their underlying characteristics.

Einstein Messaging/Copy Insights

Einstein Messaging Insights gives you insights automatically generated based on the characteristics of your email sends, such as an unusually high or low response rate. They appear as notifications and allow you to drill into the details.

By contrast, Copy Insights uses the same underlying information to predict what subject lines will be more effective than others. That way, you can more easily craft the right message for your audience.

Einstein Send-Time Optimization

Einstein Send-Time Optimization allows you to optimize the time your emails are sent based on the historical response rate for similar emails. You use it as part of a user journey in Journey Builder, where you have the option to choose the period over which to optimize.

Einstein for Commerce

E-commerce is an area where a strong AI offering can result in direct improvements to the bottom line in an immediate way. For that reason, Salesforce's Commerce Cloud is not shying away from introducing AI features. We'll examine how they've done this in the following sections.

Einstein Product Recommendations

Einstein Product Recommendations is the core recommendation engine for e-commerce sites built on Salesforce Commerce Cloud. It leverages a state-of-the-art, AI-driven recommendation engine to show product recommendations to shoppers dynamically. The quality of product recommendations is frequently down to the historical data quality that underlies the recommendations.

One of the unique features of the Salesforce offering is sharing data between merchants, so the pooled dataset achieves a different level of scale. As for the Einstein Recommendations feature in Marketing Cloud, you need first to configure product and catalog data and a set of business rules within the configuration module. You will also need to incorporate the product recommendations in your storefront template, a fairly technical task. Once this is done, however, the recommendation engine does the rest of the work seamlessly.

Einstein Predictive Sort

One-to-one personalization is the holy grail of marketing. The more unique and well-fitted you can make the shopping experience to the individual consumer, the higher the probability that consumer will buy your product. Einstein Predictive Sort is a way of achieving this goal for search results. The underlying machine learning model crunches profile, clickstream, and order history on a customer-by-customer basis and tailors the ordering of search results to show the most relevant products for that particular customer further up the list. In practice, you add the predictive sort as a sorting rule, among other rules you configure, which gives you a more refined degree of control.

Einstein Commerce Insights

Basket analysis is one of the most common uses of machine learning in e-commerce. It shows you sets of products typically bought together, which can help with promotions and other cross-selling initiatives.

While the algorithms to perform market basket analysis are relatively old and relatively standardized, the ability to have this information automatically preprocessed and structured into well-designed dashboards and allow you to drill through and find the exact information you need adds significant value.

Einstein Search Dictionaries

Most internet users will have experienced the frustration of searching for one word only to have it return no results because the website you are searching on uses a synonym for the same word. This common frustration has resulted in almost all major websites that provide their own search mechanism implementing a search dictionary that defines synonyms between search terms.

Einstein Search Dictionaries takes the struggle out of maintaining such a search dictionary by automatically detecting relationships between search terms and linking them to a synonym list. As with product recommendations, this can be pooled across merchants, making the feature much more powerful.

Einstein for Industry Clouds

Salesforce has recently begun having a major focus on industry solutions in recognition that challenges vary tremendously between sectors. That means that metrics and models generating insight and predictions have to vary commensurately. In the following sections, we'll explore how that works across Salesforce's industry clouds.

Health Cloud

In Health Cloud, the key focus of the pre-built solution, Tableau CRM for Health Cloud, is to provide actionable insights to help customer engagement and manage patient risk intelligently to allow proactive outreach via care programs.

The offering consists of two apps:

  • Analytics for healthcare
  • Risk stratification

They both consist of a set of pre-built dashboards that give particular insights to managers and practitioners. The first is targeted principally at managers to visualize key metrics about the patient population and enable actionable insights; the second highlights at-risk patients based on configurable patient data, enabling an appropriate response.

Financial Services Cloud

The pre-built solution for Financial Services Cloud is similar to the solution for Health Cloud in providing pre-built analytical apps. However, the range of analytical apps is much broader in scope. There are pre-built analytical solutions for wealth management, insurance, retail banking, consumer banking, a dedicated wealth starter analytics app, and an app for client segmentation analytics. The common thread between these apps focuses on customer intelligence so that financial advisers can identify high-potential clients and take appropriate action to engage with them.

Manufacturing Cloud

The Manufacturing Cloud offering consists of a manufacturing analytics app that provides 14 pre-built dashboards to manage various aspects of a manufacturing business, which we'll explore in Chapter 5, Salesforce AI for Industry Clouds. There are dedicated dashboards to analyze product performance, the health of customer account relationships, and even the individual sales agreements made between your company and key customers. Compared to the Health Cloud and Financial Services Cloud offerings, the Manufacturing Cloud offering is broader in scope and more traditional, using less of the depth of capability that the platform offers.

Consumer Goods Cloud

Consumer Goods Cloud is also focused on providing pre-built dashboards that provide actionable insights to users. It contains a pre-built analytics app, which includes dashboards for typical consumer goods use cases, such as store performance or white space analysis. In addition, it also includes embedded dashboards that you can put directly into the user interface.

For instance, users can see the analytics generated for an individual store (such as the store's top-selling products) directly when looking at the store's standard Salesforce UI. Also, it contains dedicated dashboards that allow managers to drill into data for individual merchandisers.

Nonprofit Cloud

For Nonprofit Cloud users, Salesforce offers a pre-built fundraising performance analytics app. To work successfully, you need about 3 years of running data, so it's not for new adopters unless you migrate substantial amounts of data. Once you have the data, however, you get detailed analytics on both donors and giving, as well as a KPI-based performance dashboard to help you make sense of it all.

Declarative Platform Services

Declarative Platform Services allows administrators and configurators to build custom AI capabilities using clicks, not code. They are often the best way to achieve organization-specific AI functionality. We'll explore the various ways this can be achieved in the following sections.

Einstein Next Best Action

Einstein Next Best Action is one of the most powerful declarative features in your platform arsenal because it allows you to leverage all the analytical and predictive data generated by the other AI features in an action-based strategy. Simply put, Einstein Next Best Action surfaces recommendations directly in the user's normal workflow based on configurable strategies that can use key insights from your machine learning or analytical models to drive the choice. That way, you can impact user behavior at precisely the right time to drive better outcomes for your customers.

The configuration is not simple, and we will cover it in detail in Chapter 7, Building AI Features with Einstein Platform Services. However, the flow works by you outlining a set of recommendations that can be made to users, embedding these in action strategies, integrating the output of your predictive models to enable advanced intelligence in the decision-making, and configuring a component so that you can show these suggestions in the user interface.

Einstein Prediction Builder

Einstein Prediction Builder is probably the most powerful feature you have at your fingertips in the Einstein platform that you can access without writing a line of code. Salesforce refers to it as custom AI for admins, which is to some extent fair. The feature allows you to predict the outcome of Boolean or numeric fields on your Salesforce records based on historical data in the underlying objects.

You have a wide range of configuration options, including what fields to include in the prediction, what data to train on and which to exclude, and where you want to store your predicted outcome. It also comes with extensive monitoring tools that allow you to assess the quality of your prediction. However, you do not have any control over what machine learning model is chosen to predict your data.

That way, you can have the prediction running in the background for an extended period and only deploy it into the user experience when you are comfortable that it works as intended. The prediction itself, because it is stored directly in the data model, can be used throughout the Salesforce platform, including all the standard automation features.

Einstein Discovery

Einstein Discovery is where the AI features of the platform meet the analytical ones. Like Einstein Prediction Builder, Einstein Discovery uses supervised machine learning models based on existing data. However, the purpose of Einstein Discovery is not first and foremost to predict future outcomes but to gain deep insights that will allow you to change those outcomes by taking appropriate action.

In the terminology of the tool, what Einstein Discovery generates is a story, that is to say, a beautifully visualized statistical model that shows what factors contributed the most to the outcomes we have observed. For instance, we may find that color is a significant determinant of product sales in our catalog, but that one particular shade of green that sells exceedingly well in Bavaria is a death knell to a product sold in Provence.

The insights you generate with Einstein Discovery can be made actionable in several ways. This would typically be as parts of reports or dashboards, or as contextual information for a record. But it is also possible to make them directly actionable within the Salesforce platform, for instance as part of an automation.

Programmatic Platform Services

Programmatic Platform Services is the most powerful set of services you will have at your disposal when working with AI on-platform. They allow you to tap directly into the AI capabilities of the Salesforce platform by calling APIs. In the following sections, we will introduce the various options.

Einstein Vision

Einstein Vision is a powerful programmatically accessible API that allows developers to access both pre-trained classifiers and to train custom classifiers to solve a range of different use cases in the computer vision domain. The first service is image classification that enables you not only to detect cats in YouTube videos but also, for instance, to classify images in your content catalog or uploaded content from your user base to automate and enrich your business processes.

You can also use Einstein Vision for object detection, which can give you granular details about the size and location of objects in an image, something that can be very useful, for instance, in a field service setting. Finally, an OCR service can help you to convert all of that printed documentation that might still exist within your company into a digital form.

Einstein Language

Einstein Language is the second central API released as a part of Einstein Platform Services. As with the Vision API, you have the option of using pre-built models or creating custom models for your language domain. The first service, sentiment analysis, analyzes text to give an indication of the emotional valence it conveys. You can use it, for instance, to detect negative comments and respond with a support follow-up automatically or, conversely, detect positive statements to give people a thumbs up.

The intent API instead categorizes unstructured text into user-defined labels, trying to map the unstructured text into a more meaningful context that you can use for routing in automation. For instance, you can detect different topics within text messages and automatically respond to the right person for handling.

Finally, the named entity recognition (NER) API allows you to detect entities in unstructured text. For instance, you could detect every time somebody uses a currency amount and your company stock ticker symbol to detect conversations about target stock prices.

 

What's special about architecting for AI?

Traditional solution and technical architecture are well-established disciplines with a range of solid approaches and methodologies that can all lead to good outcomes. However, all of these methodologies are based on assumptions that are questionable, if not decidedly false, when architecting for AI solutions.

Next, I will present seven key differences from traditional architectural assumptions that you should keep in mind throughout the rest of the book and in the future when you apply the knowledge in practice.

In short, AI solutions have the following characteristics:

  • Probabilistic
  • Model-based
  • Data-dependent
  • Autonomous
  • Opaque
  • Evolving
  • Ethically valent

While not unique to Salesforce, these considerations are essential when creating AI solutions on the Salesforce platform. Because you are given so much out of the box, it can be tempting to follow a traditional mindset in your architecture and design. This will backfire.

Probabilistic

Days before the beginning of the 2018 soccer World Cup, researchers from the German Technische University of Dortmund, the Technical University in Munich, and Belgium's Ghent University predicted the winner of that year's trophy. They had run 100,000 simulations and had concluded that Spain was going to win. They weren't alone. Researchers from UBS, Goldman Sachs, and several other universities joined in the fun. They used a variety of approaches and predicted different winners. The only thing they shared was that they all got the winner wrong. Only a single machine learning prediction – from EA Sports, makers of the FIFA 18 computer game – picked the correct winner of the tournament, France.

This story might seem disheartening to some. However, it is not something to preoccupy yourself with much, as long as you understand that machine learning systems are inherently probabilistic, not deterministic. In the aforementioned predictive model, Spain was given an overall 17.8% chance of winning. This was more than France's 11.2% but hardly a ringing endorsement. Therefore, we shouldn't be surprised at what happened but acknowledge that any prediction is most likely going to be wrong for one-off events.

Where AI solutions have real value, instead, is when we have repeated events occurring over and over again. If we had 1,000 world cups running one after the other, most likely Spain would have won more of them than France, and this would be actionable information we could use in our processes – perhaps to manufacture or promote more Spanish merchandise.

In our day-to-day processes, we have events happening millions of times and usually with much less variability than in a world cup. Our ability to predict is, therefore, much better. However, that can also lead to problems. A prediction that is too good can come to be taken as a certainty, and we can end up designing our systems so they fail when we encounter outliers. The key when developing AI-based solutions is to look hard at the data and the predictions and then to come to a reasonable compromise about what level of process use they will sustain.

Model-based

In contrast to traditional solutions, AI-based architectures use models rather than prescriptive code to solve a problem. This requires a shift in thinking on behalf of the architect. There is a famous mini short story by the Argentinian writer Jorge Luis Borges, called On Exactitude in Science. It is written in a single paragraph and can be found at the following link: https://walkerart.org/magazine/empire-art-cartography-attained.

A map covering the whole territory is useless, just as trying to capture all the complexity of your processes and data in a machine learning model is futile. In traditional solution design, we tend to be precise and specify all the rules and exceptions; in an AI system, that leads to your predictions not generalizing. You get good results on the data you already have and terrible results on future data. The most useful map size, just as the most useful model size, is big enough to let you see the amount of detail you need and no larger.

Data-dependent

This point is hopefully apparent based on the discussion we have had so far in this book. The quality of predictions in an AI-based system is proportional to the quantity and quality of the data used to build the models by which the system predicts.

Think back to the recommendation systems of the early internet, based as they were on synonyms and manual encodings of likeness. Let's for a moment assume that you are searching for thermal socks. The website might show you different pairs of socks based on that search, but you would be unlikely to be shown other pieces of thermal ware that you might want unless the retailer was very good at managing their catalog. Most likely, you would not be offered a good selection of other winter gear that might be relevant to your current pursuits, and certainly, the website would not customize it to your personal preference or the preference of other shoppers like you.

Love them or hate them, these features are all run-of-the-mill today, and that is mostly because certain internet companies have vast troves of data that they can use to generate such recommendations. The actual improvement in recommendation algorithms pales in comparison to the impact of more data.

Autonomous

Ethereum, the second-largest digital cryptocurrency, saw its price drop from more than $300 to as low as $0.10 in a matter of minutes on June 22, 2017. This crash was caused by a single massive sell order triggering more than 800 stop-loss orders, orders set to sell once the price hit a certain level automatically. There seems to have been no malice or wrongful action involved, merely the interplay of many automated agents acting in an uncoordinated but similar way.

If the interplay of relatively dumb rule-based agents can lead to this level of disruption, what will happen when we start to divulge more autonomy to AI-based systems? We don't know, but almost inevitably, when we start having bots and predictive automation on our key business systems, there will come a time when we start seeing unexpected behavior. Maybe our bots will begin to undo each other's work because they have conflicting instructions, or perhaps we will see messages being sent in a loop because there is a hidden circularity in one of our models.

For now, the consequences are likely to be minor inconveniences, but as these systems grow in responsibility and complexity, so will the problems. It is, therefore, essential to ensure that you have appropriate monitoring and humans in the loop at the right points in the process. You might be able to get away with not having it for a little while, but the long-term consequences of inaction will most likely be considerable.

Opaque

When I was starting out building machine learning models, I worked on a binary node classification problem using large graphs. I had a large set of graphs that contained different structures, and based on those structures, the nodes within the graph should be labeled either Yes or No, depending on whether the program should include the node in question in the output. I ran my initial model and was pleased with myself when I got 97% accuracy.

I then tried the model in practice, and it failed utterly. It just didn't work. I started digging around in the data and the model training, and after a (too) long time, I found the problem. Within my training data, a small number of graphs were huge (100–1,000 x the size of the other graphs) and had a structure that meant everything should be classified as No. These graphs represented unsolvable problem instances. When I had trained my model, what had happened was because of this overwhelming preponderance of No in the training set that I hadn't spotted because the unsolvable graphs had not been a part of my initial data analysis, the model had learned to say No 100% of the time. Because 97% of the cases were No, that gave 97% accuracy.

There were many failings on my part in this example:

  • I didn't do proper exploratory data analysis.
  • I didn't check my assumptions.
  • I jumped too quickly into implementation.
  • I had an inadequate evaluation framework in place.

However, what it also underscores is that AI systems can be opaque. There isn't a simple way to go into debug mode, step through the code, and work out what is happening. Therefore, the evaluation and gradual implementation of models are critical factors to consider whenever you are rolling out these kinds of systems.

Evolving

On March 22, 2016, Microsoft unveiled Tay, a Twitter chatbot, as an experiment in conversational understanding. Tay used advanced deep learning technologies to learn from conversations with real humans. According to Microsoft, the more you talked with Tay, the better he would get at conversation. Less than 24 hours after, Microsoft took Tay offline after spewing Nazi and anti-feminist rhetoric, which is too colorful to include in a serious work on technology. Effectively, after being targeted by an army of Twitter trolls, Tay had learned what they had to teach him and parroted them with alarming accuracy.

While Tay presents an extreme example, the fact of the matter is that machine learning systems learn. And they learn from the data that you feed them. Most of the models you build on the Salesforce platform will continue to learn after you deploy the initial model, and as the incoming data changes, so will the models, mostly for the better and sometimes for the worst. That may mean that your models' performance also changes over time, and you may get a question from your business users as to why. Again, monitoring the model regularly and having a plan for continuous validation is a good idea.

Ethically valent

The final factor to consider is that AI systems are ethically relevant in a way that most traditional computer systems are not. Data contains bias, and if you aren't careful, your models will reflect those biases. Google, for instance, was recently forced to apologize for their computer vision model generating racist labels. For example, a black hand holding a thermometer was assigned a label of gun, while an identical white hand holding the same thermometer was labeled monocular.

There are good frameworks and principles for addressing these problems, and Salesforce is one of the major technology vendors that has dedicated the most effort to ensuring responsible use of AI, incorporating such principles in its work.

Now, having understood how to architect for AI solutions, let's move on and meet the company whose requirements we'll be following throughout the book.

 

Meet Pickled Plastics Ltd.

You always learn better from an example. Therefore, when going through the technical material in this book, we shall relate it to real-world scenarios to make them more concrete and meaningful. The vehicle by which we shall do this is the fictional company Pickled Plastics Ltd. In this section, I will go through the company, its IT infrastructure, and its use of Salesforce. This will be the baseline environment into which we will be adding new functionality as we go through the chapters to come.

Pickled Plastics Ltd. is a UK-headquartered manufacturing company, with local sales subsidiaries in 37 countries worldwide. The company is family-owned and employs about 3,000 people, with most being either in production or sales. The company has historically been slow to adopt new technologies. Still, 5 years ago, it hired a particularly forward-thinking Chief Information Officer (CIO) and is now considered among the most technologically forward manufacturers in the UK. This has coincided with a period of high single-digit growth, which for the industry is considered excellent.

Pickled Plastics Ltd. has been a Salesforce user since 2011, but it was only with the new CIO's entry that it started taking it seriously as a significant business-critical system. Now, however, it is a serious user, with a well-established center of excellence. It has adopted the Sales and Service Cloud throughout the business and across all subsidiaries. Besides, it has an extensive Community Cloud implementation, catering to its distributors in various countries.

Outside the UK, most business is done B2B through local distributors, but in the UK itself, Pickled Plastics Ltd. also sells directly to consumers through a subsidiary called Handsome Homewares. Handsome Homewares has a standalone Salesforce environment that includes Marketing Cloud, which is used to deliver customer journeys via email marketing, and B2C Commerce Cloud, which runs a small-scale webshop. The company is considering rolling out a B2C presence in more countries, so the technology investment in Handsome Homewares is also seen to prepare for this eventuality.

In addition to Salesforce, Pickled Plastics Ltd. is heavily invested in a reasonably old SAP implementation that runs all major backend processes and financials. It has a bespoke homemade middleware platform that it maintains, although replacing this is on the long-term roadmap. It has experimented with various public clouds and is open to using these services, but has not invested heavily in any of them so far.

You can see an overview of the system landscape in the following diagram:

Figure 1.3 – Pickled Plastics Ltd. system landscape

Figure 1.3 – Pickled Plastics Ltd. system landscape

The key strategic priority for the next 3 years of IT investment is AI. The company has so far not conducted any serious studies or done any real projects in this space. Still, with her usual bravado, the CIO has declared that Pickled Plastics Ltd. will have become an AI-driven intelligent manufacturer within 3 years. What that means is still a little unclear, but the appetite to invest in AI projects is clear.

Because of how its center of excellence is set up and the kind of capabilities it has in-house, Pickled Plastics Ltd. has a strong preference for out-of-the-box solutions. All of its existing implementations use 90%+ configurations over customization, and it has a strong preference for continuing this principle in the future. That being said, if there is a genuine need to do something different, it can make it happen. While the company does not have many deep technical resources on staff, these can be procured through long-standing vendor relationships. The preference, however, remains for out-of-the-box solutions.

Throughout the rest of the book, we shall be checking back in with Pickled Plastics Ltd. on an ongoing basis to see how the features we are talking about can help it on its journey. At the end of the book, it'll be a lot closer to realizing its goal of becoming an AI-driven business.

 

Summary

In this chapter, we started by looking at why we need to bring AI capabilities into our CRM. The key takeaway was that AI capabilities allow you both to personalize and improve the service you deliver to customers, both before and after purchase, in a way that represents a step change in comparison to traditional CRM. Additionally, AI allows you to automate and simplify many labor-intensive processes.

We looked at the layers of the Einstein platform and examined how we can use pre-built solutions to get a head start with AI capabilities. Equally, we looked at both the declarative and the programmatic platform services that you can use to extend the native capabilities.

Then, we took a whistle-stop tour through the different elements that make up the total Einstein offering, including sales, service, marketing, commerce, industry solutions, and platform services. This gave us a sense of both the depth and breadth of the platform as a whole.

Then, we changed tack and looked at the general question of how architecting AI solutions is different from architecting traditional solutions. We learned that seven characteristics define AI architecture, namely that AI solutions are probabilistic, model-based, data-dependent, autonomous, opaque, evolving, and ethically valent. This gave us a starting point for how to approach the deployment of these capabilities in the real world.

Finally, we learned about the fictional company Pickled Plastics Ltd., whose requirements we will be using as a reference throughout the book. And now, with the preliminaries out of the way, we will dive straight into the principal matter of the book and look at AI features for sales.

 

Questions

  1. Why would you want to build AI features on Salesforce?
  2. What are the components of the Salesforce Einstein Platform?
  3. What are some of the special things about architecting for AI?
About the Author
  • Lars Malmqvist

    Lars Malmqvist is a 32x certified Salesforce CTA and has spent the past 15 years in the Salesforce ecosystem building advanced solutions on the platform. Currently, he works as a partner in the management consultancy, Implement Consulting Group, focusing on supporting large Nordic Salesforce clients in their transformation journeys. He has published two books, Architecting AI Solutions on Salesforce and Salesforce Anti-Patterns, both with Packt publishing.

    Browse publications by this author
Architecting AI Solutions on Salesforce
Unlock this book and the full library FREE for 7 days
Start now