Skip to main content

How We Built Personalization and Natural Language into CRM Search

Christian Posse
Christian Posse
Nov 11 - 4 min read

Einstein Search is an exciting new feature from Salesforce that introduces both personalization and more natural language via conceptual queries.


Personalization relies on a dynamic profile of interest built for each of our CRM users. The idea is pretty simple: whenever a user interacts with Salesforce, we learn something. Behavioral analysis of recent interactions with records reveals 1) which objects a particular user has been predominantly handling and whether it is a standard Salesforce object such as account or opportunity or a custom object known only by the user’s organization, and 2) which values of any standard or custom field within any object the user has been mostly interested in.

Combining user search profiles with user search activities (more precisely, clicked records in search results) at a global scale across all of Salesforce enables us to efficiently train machine and deep learning based personalized ranking algorithms. Given a user and a query, a first algorithm leverages the user profile to rank objects based on their likelihood to match the user’s query intent. Next, algorithms at the object level rank matching records, boosting records with field values matching the user profile. The size of the boost is determined by the strength of the user interest for a given field value and the relative importance of the field itself.

To illustrate the object level algorithms, consider two Salesforce users, Kara and Ben. Kara and Ben are both sales executives but they are each interested in different regions. Their dynamic user search profiles reveal that for accounts, Kara is 60% more likely to interact with records in the east, whereas Ben is 10% more likely to interact with these same accounts. Kara is also 50% more likely to interact with records in the health industry, whereas Ben is 10% likely to interact with this same industry. On the other hand, the account ML algorithm determined that industry is twice more important than region field. When Kara searches for an Acme account, the ranking algorithm will return first the Acme United Corporation record located in the central region but in the health industry. The same search for Ben will return the Acme Technologies record which matches both of his field value preferences.

An interesting challenge was how to learn the relative importance of custom fields which are inherently specific to a single organization. We solved this problem leveraging Salesforce’s extensive customization capabilities. This is better explained with an example. Salesforce administrators at a given organization can customize the search result layout by selecting which fields should be shown in search results for each object. This informs us that these selected fields, regardless of what they are, are critical for finding the right record. In other words, the selected fields in the search result layout share the same business function. This gives us the opportunity to learn the relative importance of the search result layout itself in a global manner (as the business function is understood by all organizations). From this we can infer the relative importance of the fields in the search result layout — — including custom fields — — by assigning the search result layout importance to each of the selected fields, even without knowing the content of the custom fields.

It is important to note that user search profiles are currently constructed on the fly at query time and never stored to preserve data privacy of Salesforce customers.

Natural Language Queries

Einstein Search enables more natural language search via conceptual queries. A common task on Salesforce is to create a filtered object list/report, which takes many steps and cannot be done via keyword based search. Our initial conceptual queries solve this problem. Suppose that Ben is looking for his new Acme opportunities last month. The only thing he has to do now is type exactly this: ‘my new acme opportunities last month’.

We have trained a deep learning model that identifies likely concepts in query terms. Likely concepts include the top Salesforce objects of Account, Opportunity, Contact, Lead and Cases as well as the concepts of Person, Company, Ownership, Status, Location and Time. In Ben’s query there is a term — — new — -, which is not part of the likely concepts. In that case, our deep learning model assigns it to the unknown category.

If a Person or Company concept is detected we then try to resolve it to specific records for this particular user using the personalized search described above.

To resolve unlikely concepts we use picklists. Picklists are Salesforce’s primary way to customize a record state and are commonly used for narrowing object lists. We have developed an advanced matching algorithm that compares unresolved terms against picklists and return the ones that match. In our example, the opportunity object has a standard picklist called StageName, that happens to match on the unresolved term ‘new.’

At this time we are ready to generate a personalized structured query via SOQL (Salesforce Object Query Language) to retrieve the list of relevant records for Ben. This is how we use AI, Natural Language Processing and Salesforce customizations to introduce users to natural search.

Read more on Einstein Search capabilities here.

Related Artificial Intelligence Articles

View all