> For the complete documentation index, see [llms.txt](https://docs.avonnicomponents.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/data-table/add-custom-buttons.md).

# Add Custom Buttons

Put a Log Call button and an edit icon on every Opportunity row, so sales reps act on a deal right from the pipeline table.

A sales rep works through open deals every morning. After each call they want to log it straight away, and now and then fix a field on the deal. A visible button on each row does both from the table, and every click knows which Opportunity it belongs to.

<figure><img src="https://2532358799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODPvvv7Cx9Z9RECLn3oV%2Fuploads%2FJUUCFSPIhfU08L42PXdY%2Fdata-table-tutorial-add-custom-buttons-result.png?alt=media" alt="Opportunity table with a Log Call button and an edit icon on every row"><figcaption><p>Every row carries its own Log Call button and edit icon.</p></figcaption></figure>

## Before you start

* A Data Table on the Opportunity object with a **Query** data source. See [Data Table](https://docs.avonnicomponents.com/dynamic-components/components/data-table.md) to set one up.
* For the Log Call button: an active Screen Flow with a Text input variable named `recordId`, marked **Available for input** in Flow Builder.
* Several actions that should share one compact menu instead? Use [Define Row Actions](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/data-table/define-row-actions.md).

## Steps

{% stepper %}
{% step %}

### Add a button column

1. Select the Data Table on the canvas and stay on the **Properties** tab.
2. Under **Columns**, click **Add Columns** and choose **Custom**: a button is not tied to a field.
3. Turn on **Custom Label** and enter `Log` as the **Label**. Leave the label empty if you prefer a header with no text.
4. Check the column **Name**. It fills in from the label and must be unique in the table.
5. Set **Type** to **Button**.
   {% endstep %}

{% step %}

### Configure the button

Under **Type Attributes**, set:

* **Label**: `Log Call`, the text shown on the button.
* **Name**: `log_call`. The interaction listens to this name, so a button without a **Name** cannot be wired.
* **Variant**: **Brand**.
* **Icon Name**: `utility:call`, with **Icon Position** on **Left**.

<figure><img src="https://2532358799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODPvvv7Cx9Z9RECLn3oV%2Fuploads%2FNpBL9rcEKdPEmlG7QTNm%2Fdata-table-tutorial-add-custom-buttons-column-settings.png?alt=media" alt="Column settings of a Button column with label, name, variant and icon" width="320"><figcaption><p>The Name set here is what the interaction listens to.</p></figcaption></figure>
{% endstep %}

{% step %}

### Add an icon button for quick edits

Each button column holds one button. Add a second **Custom** column for the edit icon:

* **Type**: **Button Icon**.
* **Icon Name**: `utility:edit`.
* **Name**: `edit_deal`.
* **Variant**: **Border**.
* **Alternative Text**: `Edit opportunity`, read by screen readers.
  {% endstep %}

{% step %}

### Open the flow when Log Call is clicked

1. Open the **Interactions** tab and add an interaction under **Row Action Click**.
2. **Target Name**: `log_call`.
3. **Type**: **Open Flow Dialog**, then pick your flow in **API Name**.
4. Under **Input Variables**, add an item: **Name** `recordId`, then for **Value** pick the row's Id from the **Record** entries (the field then reads `Record: Id`), and set **Type** to **Text**. This passes the row that was clicked.
5. **Modal Header**: choose **Custom**, then enter `Log a call: {{Record.Name}}` in the field below.
6. Under **On Finish**, add **Refresh Query** so the table shows what the flow changed.

See [Open Flow Dialog](https://docs.avonnicomponents.com/dynamic-components/component-builder/interactions/open-flow-dialog.md) for the other settings.

<figure><img src="https://2532358799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODPvvv7Cx9Z9RECLn3oV%2Fuploads%2Fni1ayP1lfegypSdU3nHz%2Fdata-table-tutorial-add-custom-buttons-interaction.png?alt=media" alt="Row Action Click interaction opening a flow with the row Id as input" width="320"><figcaption><p>The flow receives the Id of the row that was clicked.</p></figcaption></figure>
{% endstep %}

{% step %}

### Open the record in edit mode from the icon

Add a second interaction under **Row Action Click**:

* **Target Name**: `edit_deal`.
* **Type**: **Navigate**.
* **Page Reference Type**: **Record Page**.
* **Object Api Name**: Opportunity. **Record Id**: the row's Id from the **Record** entries. **Action Name**: **Edit**.

See [Navigate](https://docs.avonnicomponents.com/dynamic-components/component-builder/interactions/navigate.md) for the other destinations.
{% endstep %}

{% step %}

### Save and test

Save the component and open the page where it is placed. Each row shows a blue **Log Call** button and a pencil icon. Click **Log Call** on one deal: the flow opens with that deal's name in the header. Click the pencil: the edit form of that same Opportunity opens.
{% endstep %}
{% endstepper %}

## Troubleshooting

<details>

<summary>My button does not appear in Target Name</summary>

**Target Name** lists the **Name** of each button, button icon and row action. Open the column, check that **Name** is filled under **Type Attributes**, then come back to the interaction.

</details>

<details>

<summary>The flow variable is missing from the Name list</summary>

Only variables marked **Available for input** in Flow Builder are offered. Edit the variable in your flow, tick the option, activate a new version, then reopen the interaction.

</details>

<details>

<summary>The flow opens but receives no record</summary>

Map **Value** from the **Record** entries, which hold the row that was clicked. **First Selected Row** follows the selection checkboxes, so it stays empty unless the user also ticked that row.

</details>

<details>

<summary>Export does nothing since I added the button column</summary>

A known issue affects tables with a button, button icon or action column when the query returns more rows than the table has loaded. See the Troubleshooting section of [Enable Data Export](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/data-table/enable-data-export.md).

</details>

## Related tutorials

* [Define Row Actions](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/data-table/define-row-actions.md): group several actions in one menu per row.
* [Configure Header Actions](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/data-table/configure-header-actions.md): one button that acts on all selected rows.
* [Open a Record from a Row](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/data-table/open-a-record-from-a-row.md): make the whole row, or the record name, open the record.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.avonnicomponents.com/dynamic-components/tutorials/components/data-table/add-custom-buttons.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
