Using Flow to Display Key Information on Record Pages

Using Flow to Display Key Information on Record Pages

Page layouts display record's fields in the same format. Each field has its own field type, but at the end, colors and sizes are the same. However, sometimes we want to highlight a field or display a colorful indicator that will take the user's attention. There are a few ways to display key information. Thanks to Lightning Pages, it is even easier than before.

First of all, you can build a formula field that displays an image. By doing so, you can have an indicator on the page, which will take the user's attention.

Using Flow to Display Key Information on Record Pages - Status Icon

Secondly, you can put a standard Rich Text component of the Lightning Page. Even though it is not possible to use merge fields in this component, you can display a rich text (including a colorful message, an image, a link, etc.) on the page. By setting component visibility, you can decide do display it only if the criteria is met. For example, you can display a red message if the account is blocked for technical service. This will take the user's attention more than a checkbox field does.

Using Flow to Display Key Information on Record Pages - Rich Text

Another way to do this is creating a Screen Flow and placing it on the Lightning Record Page. The reason behind using a flow is that you can reach to any record and build your logic. So it means that you are not limited to using the fields from the current record.

If you don't know how to build a Screen Flow, you can read this post.

Using a Screen Flow, you can get records related (or even not related) to the current record and display a dynamic message to the user. I think this is the best way out of these options. For example, you can display a message on the account page if the number of related contacts is not equal to the Employees field of the account record.

Using Flow to Display Key Information on Record Pages - Text with Flow

However, I will show you a different approach with the help of two custom flow screen components. I am not saying that this is the best option, but it is different and effective.

Let's create a Screen Flow that displays a toast message with a beep sound on the account page, only if the current user has open tasks related to the record.

Before Building the Flow

Before creating the Screen Flow, there are a few steps to perform. First of all, you have to install the components that you will use.

First one is an Invokable Action called Show Toast and it can be installed from this link. This is the main idea of this flow, so it is a must to install it.

Second one is a Lightning Component called Play Sound. It lets you play any sound file on a flow screen. Read this post to learn more about this component. Installation link can be found from there as well.

Building the Screen Flow

1- Create a new flow and select Screen Flow. Even though you are creating a Screen Flow, there won't be anything on the screen.

2- Get all the open Task records that the current user has for the current Account record. It is important that you store all records and not only the first one.

Using Flow to Display Key Information on Record Pages - Get Tasks

3- Create a new number variable called RecordCount and assign the number of items from the Tasks collection that the flow created for you in the previous step.

Using Flow to Display Key Information on Record Pages - Assignment

By doing so, this variable now shows how many tasks the user has for the current account. If there is no task, the number will be zero.

4- Flow should not display a toast message if there is no open task record. In order to do so, you have to add two paths using the Decision element.

Create a new Decision element and check the RecordCount variable.

Using Flow to Display Key Information on Record Pages - Decision

5- If there is no Task record found, the flow should do nothing. Create a screen without anything and connect the "No" decision outcome to this screen. If you don't do something like this, it will display "YOUR FLOW FINISHED".

Using Flow to Display Key Information on Record Pages - Blank Screen

6- Create a new Text Template and enter the message that you will display as a toast message. Use the RecordCount variable to display a dynamic message. You can display a message like this: You have {!RecordCount} open tasks!

Using Flow to Display Key Information on Record Pages - Text Template

7- Add an Action element from the Toolbox and select the action called showToast. This is the action that you installed before creating the flow. You can display a few types of toast messages (success, warning, error, info, other). Since this one is more like a warning to the user, you can choose to display a warning (orange) toast message. However, it is optional, you can choose any of them.

Using Flow to Display Key Information on Record Pages - Show Toast

8- Add a new screen and drag and drop the SoundCMP. This is the Lightning Component that plays a sound effect. As mentioned in its user guide, you have to upload your sound file to Static Resources. In this use case, we will play a Beep sound. You can download it as a mp3 file from this link.

Using Flow to Display Key Information on Record Pages - Play Sound

At the end, your flow should look like this.

Using Flow to Display Key Information on Record Pages - Flow

Optional Steps

This version of the flow is enough to accomplish what we need. However, it will display a toast message (if there are open tasks) whenever you open an account record. Some users might find this annoying (but that is the point, it should take their attention). Optionally, you can display the toast message only once a day (for each account, of course).

1- Create a custom date field on the Account object and name it as Last Toast Message Date.

2- Add a Get Records element to the beginning of the flow. Get the first account record according to the recordId variable. Since Id is a unique value, it will get the current account record.

Get Account Details

3- Add a Decision element to check if a toast message was displayed for this account today.

Decision to Display Key Information

If it was displayed, then we don't want to display it again. In order to do so, connect the "Yes" outcome to the blank screen that you created before. If not, continue with getting the task records.

4- Add a Update Records element after displaying the toast message. Update the current account's Last Toast Message Date field with the current date.

Update Account Field

5- Add Fault paths for handling the errors. If the toast message fails, then go to the blank screen. If account update fails, go to the screen that plays the beep sound. Read this post if you don't know what Fault path is.

6- Go to the version properties of the flow, click Show Advanced and choose System Context Without Sharing - Access All Data. By doing so, the flow can access all data.

Flow Properties

At the end, your flow should look like this.

Final Version of the Flow

Add the Flow to the Lightning Record Page

The last step is to add the screen flow to the Lightning Record Page of the Account object. Make sure to add it to a place that no one will notice. Since the flow doesn't display anything on the screen, there will be a white line on the page (it is the blank screen of the flow).

Adding the flow to the record page
Display Flow on the Record Page

Show Time


  1. Hello!

    I need to display a message on the opportunity until it has a related record. I created a flow following your instructions, however, at the end of the execution it displays the message [Flow Name ] YOUR FLOW FINISHED, even if I deleted the screen element from flow. Would you know how could I solve this?

    Thank you in advance

1 Trackback / Pingback

  1. Invisible Screen Flows - Salesforce Time

Leave a Reply

Your email address will not be published.