Disabling Header Actions if No Records Are Selected in Avonni Data Table

In this tutorial, you'll learn how to disable the Header Action if no records are selected on the Avonni Data Table (in case you have a header action for selected records). This can be useful to prevent users from performing certain actions when there are no chosen rows in your data table. We'll achieve this by using the "Reactive components" from Salesforce.

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