Using Flow To Enhance Salesforce Knowledge
Traditional Knowledge is managed using page layouts and records. Let’s look at how a flow-based approach allows your Knowledge implementation to tap into new capabilities. We’ll also see where the current Flow infrastructure is limited relative to today’s Knowledge experience.
Below is an example of a new Knowledge solution that uses Flow and NBA, placed immediately above the standard out-of-the-box Knowledge component:
By delivering Knowledge via this new approach, we gain some new features. Specifically, we’ll demonstrate how you can do the following things that are not possible with the OOTB Knowledge solution:
- Accurate View Counts Filtered By Time Slice (“Last 30 days”)
- Conditional Field Visibility (Only show this text block if that check box is checked)
- Hide Required Fields (Suppress fields that are required by the Knowledge record, such as urlName, so they don’t clutter the screen
Here’s a video demonstrating these features:
Creating a New Article
Let’s start by creating a new article. When the user clicks the New Article button, they receive a choice of templates:
Selecting one runs a screen flow that presents a form for creating the article:
Importantly, this is actually a screen from a screen flow instead of the traditional record edit form for a Knowledge record. The end result (create a new Knowledge record) will be exactly the same, but because we’re tapping into the more sophisticated Flow screen technology, we get some immediate advantages:
Some fields only appear if other fields have particular value. Here the Impact Reason field only shows up if the Impact Rating is above 7:
Additionally, note that the undesirable urlName field is absent. Here you can see that in a typical Knowledge layout, you can’t remove urlName because it’s required:
This field is auto-generated and many customers don’t want their article creators to have to think about it.
When we fill out the form and click Next, a new Knowledge record is created.
Searching for a Knowledge Record
Let’s first take a look at how Knowledge NG works. As can be seen here, we’re interacting with a flow called Knowledge NG and specifying a ‘strategyName’:
The Knowledge NG flow consists of a single screen with a single LWC:
The ‘Display Knowledge NBA Recommendations’ component tells us that we’re actually using the NBA framework to query for Knowledge. When a search is initiated in the component….
… the component runs a Recommendation Strategy Flow, using the strategyName passed in by the page builder. That flow has an invocable action that calls the existing Knowledge search API. Here’s what this flow looks like:
As is the case with all Recommendation Strategy Flows, this one queries a ‘source of insight’ and converts the results to the standard recommendation object format.
Viewing a Knowledge Record
When the View button is clicked on a Knowledge record, the solution launches the same flow that was used to create the record. Here’s what it looks like:
Here we see some of the limitations of the current Flow-based approach. Flow doesn’t distinguish between Edit mode and Read mode, so all of the fields are shown in edit mode. The rich text is supported here by an installable extension, but there’s no way to increase the visible lines of that field, or show it in edit mode. These elements are on Flow’s roadmap, but not expected in 2022.
Reporting on Knowledge Activity
Since the Get Knowledge action shown above is basically just calling the existing Knowledge api endpoint, why go through the trouble of running it through the NBA framework? One reason is that we inherit NBA’s relatively strong reporting infrastructure. Each time a user clicks the View button on a search result in our Knowledge NG solution, it’s recorded as a ‘recommendation accept’. As a result, we can create powerful reports that are not currently available to Lightning Knowledge users. This report shows the number of times articles were viewed in a recent 1 week period:
This project can not currently be package, but can be deployed via sfdx. It’s available here.
First, make sure your org has the prerequisite files installed:
This package requires the following pre-requisite packages, installed in order:
- Flow Actions Base Pack and the Flow Screen Components Base Pack. Install them here.
- Navigate Everywhere. Install it here.
- ExecuteNBAStrategy. Install it here. (never was packaged. currently seems to need Spring 22, so has to wait until sandboxes get updated)
- Open URL Install it here
- GenerateFlowLink Install it here