# Edit Selected Records

## Overview

The **Edit Selected Records** interaction allows users to perform bulk updates on multiple rows simultaneously. When this action is triggered—either via a Header or Row action—a modal opens, prompting the user to select a field and specify a new value.

The component then processes the update for all currently selected records in a single backend transaction. This ensures that changes are applied efficiently across the entire selection without requiring individual record edits.

#### Prerequisites

The **Edit Selected Records** operation is exclusive to the Data Table component. This exclusivity is due to the table's architecture, which enables precise row-level selection and the batching of record IDs required for native mass updates.

<a href="/pages/85KP6lw2JA3gubQtgLFy" class="button primary" data-icon="pen-to-square">Tutorial: Enable Bulk Editing on the Data Table</a>

***

## How to Configure Edit Selected Records interaction

Follow these steps to enable bulk editing capabilities within your Data Table.

### **1. Enable Selection and Map Editable Fields**

Before setting up the interaction, you must prepare the table and define which fields are editable.

* **Enable Row Selection**: In the Data Table property editor, ensure "**Hide Checkboxes**" is **unchecked**. This is mandatory if you intend to use mass editing via the Header.
* **Define Editable Fields**: Within the component configuration, navigate to the Fields section. You must specify which fields are "Editable." Only fields selected here will appear in the modal popup when the user triggers the interaction.

***

### **2. Choose Your Interaction Placement**

The behavior of the Edit Selected Records operation changes significantly based on its placement:

| Placement         | Behavior                                                                          | Requirement                                               |
| ----------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------- |
| **Header Action** | **Mass Edit**: Updates all records currently checked/selected by the user.        | Checkboxes must be enabled.                               |
| **Row Action**    | **Single Edit**: Updates *only* the specific record where the action was clicked. | Does not require checkboxes; ignores other selected rows. |

***

### **3. Create and Configure the Interaction**

Once your actions are defined in the Properties panel, you must assign the "Edit Selected Records" logic to them via the Interactions tab.

* **Navigate to Interactions**: Open the Interactions tab in the component builder.
* **Select Your Action**:
  * For **Bulk Updates**: Click on the **Add** **Header Action Click** to create the interaction.
  * For **Single Record Updates**: Click on the **Add** **Row Action click** to create the interaction.
* **Assign the Operation**:
  * **Type**: In the operation dropdown, search for and select **Edit Selected Records**.
  * **Target**: Ensure the target is set to the specific Header or Row action name you intend to use.

<figure><img src="/files/gbFvJtgzVNM9b1kjUCV2" alt="" width="375"><figcaption></figcaption></figure>

* **Post-Action Configuration** (Optional): To improve the user experience, you can define what happens after the edit is completed or if it fails:
  * <mark style="background-color:$success;">**On Success**</mark>: It is highly recommended to add a Refresh All Queries interaction to ensure the table displays the updated data immediately. You can also add a Show Toast notification to confirm the update was successful.
  * <mark style="background-color:$warning;">**On Error**</mark>: Add a Show Toast notification with the "Error" variant to display Salesforce validation or system error messages to the user

***

## User Experience

When the feature is active, the end-user workflow is as follows:

1. **Select**: The user checks the boxes for the desired records.
2. **Trigger**: The user clicks the Edit button in the header or in the row action column.
3. **Input**: A popup window appears. The user selects the field to update and enters the new value.
4. **Confirm**: Upon clicking "Save," the component processes the batch update and refreshes the data view to reflect the changes.

***

## Technical Details & Limits

* **Automatic ID Collection**: You do not need to manually pass a collection of IDs. The component automatically identifies which rows are checked and sends those IDs to the update service.
* **UI Feedback**: Once the user submits the changes in the mass edit modal, the Data Table performs a "silent refresh" to update the displayed values without reloading the entire page.
* **Error Handling**: If a Salesforce validation rule or trigger prevents the update, the Data Table will catch the exception and display the error message directly to the user.

***

## Related Operations

In addition to Mass Edit, you can use the same setup steps to enable:

* [**Delete Selected Records**](/dynamic-components/component-builder/interactions/record-operations/delete-selected-records.md): Permanently removes all selected records after a user confirmation prompt.
* [**Duplicate Selected Records**](/dynamic-components/component-builder/interactions/record-operations/duplicate-selected-records.md): Creates copies of all selected records with the same field values.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.avonnicomponents.com/dynamic-components/component-builder/interactions/record-operations/edit-selected-records.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
