Einstein standing next to text that says, "AI for Admins: Einstein Article Recommendations in Flow."

AI for Admins: How to Deflect Cases with Recommended Articles in Flow

By

What if you could make that long queue of password reset emails and return policy questions disappear—saving time for your agents to focus on more complex cases?

Einstein Article Recommendations supercharge agent productivity by recommending relevant articles for a given case in the service console. Starting in Summer ’22, you can invoke your Einstein Article Recommendations model from Flow—unlocking the ability to recommend articles outside the service console for new automation use cases.

In this blog, we’ll use the new flow action for Einstein Article Recommendations to auto-respond to cases with relevant Knowledge articles. Your customers can view those articles and close their cases. This saves your agents time and solves your customers’ problems in the blink of an eye. Let’s dive in!

Recommend articles in a flow

First, navigate to the Flows page in Setup and create a new record-triggered flow. Select Case as the object to trigger the flow, and set the trigger to be whenever a record is created. You can also specify entry conditions, such as Case Origin equaling email or web-to-case.

Start conditions for a new flow triggered for cases created with origin of email or website.

Next, add an Action element and select the Create Article Recommendations action. Keep in mind that you’ll need to build and activate a model before using the Article Recommendations flow action. For the input value, use the Record ID that launched the flow.

A Create Article Recommendations action with the Record ID as the input value.

The Create Article Recommendations action will return a list of recommended articles in a JSON format. Create an Apex-defined collection variable named ArticleRecsCollection to store this output. The variable will have the Apex class ConnectApi_ArticleRecommendation.

An Apex-defined variable to hold items from the Article Recommendations JSON output.

Then, use an Assignment element to assign the output of the Create Article Recommendations action to this variable.

An Assignment element to store the output from the Create Article Recommendations action in an Apex-defined variable.

Loop through recommended articles

So far, you’ve built a flow that’s triggered whenever a case is created from a specific origin and calls Einstein to recommend relevant articles. Those articles are stored in a collection variable.

Next, add a Loop element to the flow and specify the collection variable holding your recommended articles.

A loop action to iterate over each item in the collection variable that stores recommended articles.

Use a Get Records element to fetch the published Knowledge Article Version that matches the Knowledge Article Version ID of the current item in the loop. At this step, you can add additional conditions as well, such as checking that the article is visible to the public.

A Get Records action that checks the article ID matches the current item from the loop and it is publicly visible.

Before we add the next element to our flow, we need to create some resources. Create a text template to define what data we want to store for our automated email. In the Body field, insert fields from the Knowledge Article Version retrieved in the previous Get Records element. This example stores the article title as a hyperlink, with the link set as equal to the article URL. You likely need to append the article URL merge field at the end of your public support site address.

A text template resource that captures what fields to use from the Knowledge articles retrieved by the Get Records element.

We also need two variables. The first CountRecs variable will store a count of recommended articles to send in your automated email. You’ll use this variable for a validation check later in the flow to make sure you don’t send an empty email. The second RecsText variable will store the fields from the text template you defined. You’ll include this variable in your automated email.

A variable that stores the number of recommended articles retrieved in the loop.

A text variable that stores fields from recommended articles retrieved in the loop.

Almost there! Add an Assignment element to the flow. Add 1 to the CountRecs variable, and add the RecsTextTemplate to the RecsText variable for each successful pass through the loop.

An Assignment element to store article fields and the count of recommended articles in our previously defined variables.

Perfect! We’ve built a loop that retrieves the published version of each recommended article, confirms it is visible to the public, stores the fields we need for our automated email in a variable, and counts how many articles we have recommended to send.

Next, we’ll make sure there’s at least one recommended article to send to the customer. Add a Decision element after the loop, and confirm that “CountRecs” is greater than or equal to 1. We’ll only send an email if this criteria evaluates as true.

A Decision element to determine whether there is at least one article to recommend at the end of the loop.

Format and send your auto-response email

The last step of our intelligent auto-response flow is to build and send a formatted email with those handy article links we stored in the last section. Create another text template with the contents of your email message. You can include images and rich formatting in this template. Be sure to include the RecsText variable to embed the article titles and hyperlinks you stored during the loop!

A text template resource defining the contents of a richly formatted email with recommended articles.

Now that you have your formatted text template, the last step is to add a Send Email Action element to the flow. Include your newly created text template in the Body field. Fill in the Subject field with the subject of your automated email, including any fields from the case record. Set the recipient email to the email address on the case record and set Rich-Text-Formatted-Body to true. Sender Type can be set to CurrentUser (the email address of the user running the flow), DefaultWorkflowUser, or OrgWideEmailAddress. If you want to send your email from an org-wide email, include that email address in the Sender Address field.

A Send Email action that uses the previously defined text template as the email body.

Your email auto-response flow is built! The complete flow should look like this:

A record-triggered flow that creates articles recommendations then sends them in an email.

Close the case!

Did you notice that hyperlink in our email text template? The final step is to allow customers to self-service close their case. You can build this option into your external help site from the page where customers view articles. In our example, we include a link in the email template to a website where a screen flow is embedded that allows the customer to close their case.

Example email output from the flow with identified Knowledge articles and a link to close the case.

Example screen flow where the customer can confirm they want to close the case.

If you choose to include a link to a second flow, make sure the flow is embedded on a site your customers can access, that guest users have access to run the flow, and that the flow runs in system context so they can close their case. You can also append the case ID to the URL in your email template so the flow knows which case to close when the customer loads the page.

Say hello to intelligent automation

Intelligent email auto-response is just one possibility with Article Recommendations in Flow. For example, recommended articles can also be used in a screen flow at case creation—either for Salesforce users or on a public help site—to deflect cases at creation.

And that’s not all! Einstein Case Classification is also available as an invocable action in Summer ’22, unlocking the potential to predict case fields at any point in the support lifecycle. The two flow actions could even be used together to predict and auto-populate a field like Case Reason, then only auto-respond with recommended articles for cases with specific reasons.

How will you use Einstein and Flow to drive service efficiency and delight your customers? Start thinking about it now, because Einstein for Service is coming to Flow in Summer ’22!

Resources

AI for Admins: What You Need to Know to Make Einstein Bots a Success

Einstein Bots interact with your customers quickly and accurately with automation and artificial intelligence (AI) capability. In terms of AI initiatives, the biggest challenge is measuring business impact. One reason most AI projects fail is that people are looking at “model performance” instead of business value, such as how much money, in either additional revenue […]

READ MORE

Einstein Automate for Admins

As Salesforce Administrators, you have access to Einstein Automate: the most complete, intelligent, end-to-end workflow solution on the market. Einstein Automate enables #AwesomeAdmins like you to use low-code tools to build intelligent workflows and leverage data across any system. What is Einstein Automate? Einstein Automate brings together a suite of tools across the Customer 360. […]

READ MORE

Use Einstein Next Best Action with Flow

As an #AwesomeAdmin, you know the many benefits of automating business processes with flows. But, what if you could encourage/help automate actions that your users might want to do in context? With Einstein Next Best Action, we can champion user productivity by guiding our users on the most optimal course of action based on business […]

READ MORE