Skip to main content
Build the future with Agentforce at TDX in San Francisco or on Salesforce+ on March 5–6. Register now.

Build Dynamic Top-N Queries and Add a Greeting

Top-N filters give users limiting options when viewing the number of rows in a dashboard. For example, you can have a top 10, 20, and 50 button. When you click 10, the dashboard dynamically reduces the number of items you see to the top 10. This is ideal for making your dashboard readable and giving users the power to manipulate it in a way that suits them.

In this step, you create a Top-N toggle that dynamically filters the chart widget. Then, you set up a fun greeting to make the dashboard even more personal.

Set up a Query Limit

First, set up a placeholder query limit.

  1. Double-click the column chart on the dashboard.
  2. Click Charts iconto open the Charts options.
  3. Select Bar.
  4. Click Close Date (Year) under Bars.
  5. Click the back arrow to select a group.
  6. Search for and select Opportunity Name.
  7. Click the down triangle on Sum of Amount to open sorting options.
  8. Select Sort Descending.
  9. Scroll down to Query Limit and click Edit.
  10. Enter 20 and click Apply, then click Update.

Create a Top-N Toggle

Create a toggle with Top-N values.

  1. Click an empty area of the dashboard, then click Create Query.
  2. Click Create Custom Query.
  3. Type in display values:
    1. 10
    2. 20
    3. 50
  4. Add a Text column with 10, 20, and 50 to correspond with the Display values.Toggle display and values.
  5. Click Done.

Add the Toggle to Your Dashboard

Add a toggle to your dashboard.

  1. Drag a Toggle widget to just above the bar chart.
  2. Drag the static_# lens into the widget. The hashtag (#) represents the numeric suffix added to your query.
  3. Resize the toggle to the length of the bar chart. Toggle widget.
  4. Click the toggle widget.
  5. Now, click the Query tab.
  6. Under Selection Type, select click Single selection (Required) from the dropdown menu.

Set Up Dynamic Binding

Bind the toggle to the bar chart.

  1. Click the bar chart.
  2. Click the Advanced Editor button.
  3. Click the Query tab.
  4. Under Source Query, select static_#.
  5. Click Source Data then make the following selections:
    1. Data selection: Cell
    2. Row Index: 0
    3. Column: Text2
  6. Click the back arrow next to Select Data.
  7. Under Interaction Type, click Selection.
  8. Next, expand More Options and confirm Data Serialization Functions is asString.
  9. Click the Copy button in the CREATED INTERACTION section of the page.
  10. Then, click a line in the query and search for "limit".
  11. Delete the limit value, then type "".
  12. Paste the copied code between the quotes.
  13. The limit value should now look similar to this:
    "limit": "{{cell(static_1.selection, 0, \"Text2\").asString()}}"
  14. Click Save and save the dashboard.

Test the Dashboard

  1. Click Preview.
  2. Change the Opportunity Owner list widget to All.
  3. Click each of the values in the toggle to test. Notice the amount of opportunities that show up correspond to the value you choose. Dashboard toggle dynamically updating widgets.

Create a Customized Greeting

Remember, you have the LoggedInUser query that holds the logged-in user information. You use it to create the greeting.

  1. Click Edit to put the dashboard in edit mode.
  2. Add a text widget under the dashboard headline. Move the headline up if the text widget doesn't fit.
  3. Enter Hello, in the widget’s Text property. Hello, added to text widget.
  4. Click Add Query Data.
  5. Click Select Query and select LoggedInUser_#.
  6. Now, click the Select Field dropdown menu and select Full Name.
  7. Confirm Interaction Type is Result.
  8. Click Done then save the dashboard.
  9. Preview the dashboard. Personalized dashboard with logged in user greeting.

Well Done!

You created intelligent dashboard interactions and customizations with minimal coding. Now that you know what’s possible with the Advanced Editor, feel empowered to create SOQL queries and complex bindings.

Resources

Comparta sus comentarios de Trailhead en la Ayuda de Salesforce.

Nos encantaría saber más sobre su experiencia con Trailhead. Ahora puede acceder al nuevo formulario de comentarios en cualquier momento en el sitio de Ayuda de Salesforce.

Más información Continuar a Compartir comentarios