Scaling to Thousands of Screens with Lightning Flow

In the common diagnostic use case, you have a tree structure of information and you work your way through the tree, gathering information and using it to determine the next diagnostic question. This is useful for important and distinctive use cases like troubleshooting and coming up with a good offer. Here’s an example:

Now, you can see four screens in this flow, and creating four screens isn’t too hard, especially with Flow Builder’s Duplicate tool. However, what if you have 500 of these screens? And what if this content is constantly changing and you want to make it possible for non-Admins to maintain it?

There’s a great way to address this use case, and I call it the Troubleshooter pattern. In this pattern, you don’t insert the content into screen elements. Instead you insert it into records of a custom object. Then you use a single Screen to load the appropriate custom object’s content for display. Part of the content includes a set of choices that the user can use to signal where they want to go next. Each choice points to a target set of content.

Here’s the entire flow used to show the above content:

Two custom objects have been created here:

DiagnosticNode represent a screenful of information. It includes a rich text content field to display to the agent or user or technician. It also contains a radio button group that gets loaded with all of the node’s child DiagnosticOutcomes.

DiagnosticOutcome represents a single choice/answer that might come out of a particular DiagnosticNode. It will render as a radio button choice and has two important properties: the Label and a lookup to a different “Target” DiagnosticNode.

The beautiful thing about this approach is that the creation, editing, reporting, analytics of the content nodes themselves is all done with regular Salesforce records. For example, if I want to build out my tree of decisions, I first create a new target DiagnosticNode:

And then add as many different destination outcomes as I want:

Sources of Content

The flow can display content either from the rich text “Node Content” field on the DiagnosticNode custom object or from a Knowledge article. To use Knowledge, check the box on a DiagnosticNode and select the desired article.

Editing Content

A button at the bottom of the page provides easy access to the record containing the content being looked at. This makes use of a custom Flow Screen Component called Navigation Button.

git source for the full project (including Knowledge support)

Install the Sample Flow Shown Above. (NOTE: The sample does not have the Knowledge support because of a packaging problem, but it’s easy to add).

  1. To install, you may need to:Create Custom Tabs for Diagnostic Node and Diagnostic Outcome in Setup –> Tabs
  2. Turn on visibility for each of the fields in Diagnostic Node and Diagnostic Outcome (to do this, use Object Manager, select each field, and then click on Set Field-Level Security
  3. Manually create at least one Diagnostic Node to serve as your initial node. The sample flow currently asks for the ID of that initial node. Get it from the URL.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply