Disabling Avonni Data Table Header Actions When No Records Are Selected

Sometimes, you may want to restrict actions within your Avonni Data Table until the user has selected at least one record. For instance, a "Delete Selected" header action should only be available when rows are chosen.

In this tutorial, you'll learn how to:

  • Dynamically disable or enable header actions depending on whether records are selected.

  • Prevent users from attempting actions that don't apply to the current data selection.

  • Improve user experience by offering clear visual cues about what actions are available

Step 1: Activate "Reactive Components"

  1. Open the Salesforce Setup Menu.

  2. Search for Process Automation settings

  3. Look for the "Opt in to Reactive Screens Beta" option. If it is deactivated, enable it.

If the "Reactive Screens Beta" option is not yet activated, you might need to create a new flow after the activation.

Step 2: Create "isRowSelected" Formula

  1. Once the "Reactive components" setting is enabled, go to your flow, where you have the Avonni data table.

  2. Create a new resource and select Formula as a resource type.

  3. Name your formula "isRowSelected".

  4. Data Type: select > Boolean.

  5. In the formula input field, write the following formula:

    IF({!datatable.nbSelectedRows}>0, false, true)

    This formula checks if any row is selected in the data table. If one or more rows are selected ({!datatable.nbSelectedRows}>0), the formula returns false, otherwise, it returns true.

Replace datatable in the formula with the API name associated with the Avonni Data Table.

  1. Click "Save" to save your formula.

Step 3: Map "isRowSelected" to Disabled Actions

  1. You need to map this "isRowSelected" formula to Disabled Actions in the Avonni data table.

  2. Navigate to your flow, open the screen element, and select the Avonni data table.

  3. Open the Component Builder

  4. In the right sidebar, expand the Header section.

  5. Find the "Disable Action" Toggle. Ensure you're not on the one-per-action, but the global one.

  6. Select "Mapped" from the option icon.

  7. Select the "isRowSelected" formula from the dropdown menu.

  8. Save your changes.

When no rows are selected in your data table, the Header Actions will be disabled. They will be enabled only when one or more rows are selected.

Last updated