Button

Use the Button Field to add interactive buttons to your tables. A button starts a specific action, so workflows need fewer steps. With one click on a button, you can open an external URL, run a custom webhook, run a custom script or run an automation.

The Button Field supports these actions:

  1. Open URL: Opens a new tab with a URL. A formula in the button field makes the URL. The URL can be static, or dynamic from the data of the current record.
  2. Run Webhook: Starts a webhook with the configured URL and custom payload. The payload can include data from the current record.
  3. Run Script: Runs a custom script. The script can do different operations on the current record or on the full table. In the script, use the row variable to get the data of the current record.
  4. Run automation: Runs an automation in the project. The automation starts with the When a button is clicked trigger and receives the current record.

Create a Button Field

  1. Click the + icon to the right of the Fields header.
  2. In the dropdown modal, enter the field name (optional).
  3. In the dropdown, select the field type Button.
  4. Configure the button appearance settings: the button text, color and icon.
  5. In the dropdown, select the action type.
  6. Configure the button action settings. The settings depend on the action:
    • Open URL: Use the formula editor to create dynamic URLs.
    • Run Webhook: Select a webhook in the dropdown. Or, to create a new webhook, click the + icon.
    • Run Script: Select a script in the dropdown.
    • Run automation: Select an automation in the dropdown, or select Create new automation.
  7. Click Save Field.

Button URL

image

Button Webhook

image

For the "Run Webhook" action, a webhook with the required trigger type must first be created in the Webhooks section. The same webhook can be reused across multiple Button fields. Please note that the "Run Webhook" action is not available in shared views or shared projects.

Edit Webhook

To edit a webhook:

  1. In the Button field settings, click the Edit icon next to the webhook name. The webhook settings modal opens.
  2. Edit the webhook URL, method, headers and payload.
  3. Click Save changes.

image

To open a webhook after you create it, use the Webhook section in the details tab. For more details, refer to these articles:

Deleting a webhook will remove it from all Button fields that reference it, whereas deleting a Button field will not affect the associated webhook. A single webhook can also be reused across multiple Button fields.

Button Script ☁

The Run Script action is available on all NocoDB Cloud plans and licensed self-hosted deployments.

image

Button Scripts are also called "Row Actions". Use them to start pre-configured actions directly from a record in Grid, Kanban or Gallery views. You do not have to edit fields manually to update values like status or stage. You can do repetitive updates with one click.

Each button runs a Frontend Script. The script updates the record or does other automated actions. When a user clicks the button, the script runs in the context of that record.

Sample script that updates a field value:

const recordID = cursor?.row?.id;
const table = await base.getTable("Table-1");

if(recordID) {
    // Perform operations if recordID is valid
    console.log(`Record ID is: ${recordID}`);

    // You can add more logic here based on your requirements
    await table.updateRecordAsync(recordID, {
        "Status": "Completed",
        "Title": "Default Title"
    })
} else {
    // Handle the case where recordID is undefined or null
    console.error('Record ID is not defined');
}

Button Automation ☁

The Run automation action is available on all NocoDB Cloud plans and licensed self-hosted deployments.

Select Run automation under On click to run one of the project's automations from the record. Under Automation, select an automation that starts with the When a button is clicked trigger.

An automation runs from one button only. An automation that another Button field or an interface button already runs cannot be selected.

Select Create new automation to start from an empty automation that has the trigger in place. NocoDB creates it when you save the field, then opens it so you can add the rest of the steps.

The automation must be turned on before the button runs it. Each click counts as one automation run against the limit of your plan. For what the automation receives from the click, refer to When a button is clicked.

Conditional Buttons ☁

Conditional buttons are available on NocoDB Cloud (Business plan and above) and licensed self-hosted deployments (Business plan and above).

By default, a button is always enabled for every record in the table. Use Visibility Conditions to control when a button is active, row by row. If a record does not meet the conditions, the button is disabled and shows a "Conditions not met" tooltip. This prevents accidental clicks.

Use this when a button action must be available only in some conditions. For example, enable an "Approve" button only when a status field is "Pending". Or allow a "Send Invoice" button only when the amount is more than a threshold.

Visibility conditions work with all button action types: Open URL, Run Webhook, Run Script and Run automation.

image

Setting up visibility conditions

  1. Open the button field configuration. Create a new button field, or edit an existing one.
  2. Scroll down to the Visibility condition section.
  3. Expand the section.
  4. Click Add filter. Define one or more conditions on fields in the current table.
  5. To combine many conditions with AND/OR logic, use Add filter group.
  6. Click Save Field.

image

NocoDB then checks each row in the table against the conditions:

ResultButton
Condition metThe button is enabled, and you can click it.
Condition not metThe button is disabled. When you hover over it, it shows a "Conditions not met" tooltip.

image

Editing or removing visibility conditions

To change the conditions, open the button field configuration. Then update the filters in the Visibility condition section. To remove all conditions, clear all filters and save the field. The button is then always active.

Visibility conditions use the same filter system as view filters, supporting all standard comparison operators, grouped conditions with AND/OR logic, and user-based conditions.

Availability

  • The Run Script and Run automation actions are available on all NocoDB Cloud plans and licensed self-hosted deployments.

Last updated on

Latest product updates?See Changelog
Stay in the loop? Follow us onLinkedInLinkedInYouTubeYouTubeXX