Button field
  • 14 Sep 2022
  • 7 Minutes to read
  • Dark
    Light

Button field

  • Dark
    Light

The button field is an interactive field type that lets you trigger certain actions directly from your Airtable base. This article covers how to add the button field to your base and use all of the available actions.

Overview of available actions

The button field has the following actions available. Each of these actions will be covered in more detail further in this article.

ActionDescriptionPlan Availability
Open URLOpens a new tab for a URL created with a formula within the button field. All
Open in page designerOpens page designer to display the current record. Pro, Enterprise
Run scriptRuns the script selected. Can optionally set the current record as the selection for the first record input.All
Preview URL

Displays the embed from a specific field with a URL.

All
Send email with SendGridFills the email template for the selected SendGrid extension.Pro, Enterprise
Send SMS with TwilioOpens the Send SMS extension and triggers a preconfigured SMS. Pro, Enterprise
Create document with FormstackThis action opens a Formstack Documents extension and creates a PDF or word document based on data in the record the button was clicked from.Pro, Enterprise
Attach stock photos with PexelsThis action opens a Pexels extension, where users can search for stock photos to attach to the record the button was clicked from.Pro, Enterprise
Open custom extensionThis action opens a custom extension made utilizing the Blocks SDK.All
Open source record

Only available on synced tables. From the destination table, this button allows users with adequate permissions to access the source record in the source base.

All

Once created, the button field will appear in your table as a clickable button as shown by the "Open URL" button below.

1500000731262buttonfield.png

Getting started

When adding a new field, you can choose the button field from the list of options.

360076231454Image2020-06-25at83636AM.png

In the field configuration dialog, you can set a label and style for the button.

360076231494Image2020-06-25at83758AM.png

The "Action" options are described in more detail below.

Button field actions

Open URL

This action will open a link where the URL can be based on values from your record. If the URL is for a link in the same Airtable base, clicking will send you to the URL in the same window. For all other URLs, a new window will open.

Additionally, you can enter a URL formula. This uses the same formula syntax as the existing formula field and supports using cell values from other fields (usually some sort of ID).

Integrating with other systems becomes much easier with this button as you can click the button to connect to the specific item in the other system. Here are some examples to get you going!

Tip

In the examples below, you will notice that curly brackets {} are used to insert dynamic values coming from fields within your Airtable base. It is possible to also include static values, if necessary for your workflow. For instance, if you would like to use a static email address for a "Send email" button, then that would look something like this: "mailto: staticEmailAdress@xxxxx.com" & "?subject=" & ENCODE_URL_COMPONENT({Subject}) & "&body=" & ENCODE_URL_COMPONENT({Body}).

Send an email (generic)

 "mailto:" & ENCODE_URL_COMPONENT({Email}) & "?subject=" & ENCODE_URL_COMPONENT({Subject}) & "&body=" & ENCODE_URL_COMPONENT({Body})

Send an email through Gmail

"https://mail.google.com/mail/u/0/?view=cm&to=" 
  & ENCODE_URL_COMPONENT({Email}) & "&su=" & ENCODE_URL_COMPONENT({Subject}) & "&body=" & ENCODE_URL_COMPONENT({Body})

Open an Airtable form with a prefilled linked record


 "https://airtable.com/shr123&prefill_Linked%20record=" & RECORD_ID()

Create a Google Calendar invite (Date only)

"https://calendar.google.com/calendar/render?action=TEMPLATE&text=" 
  & ENCODE_URL_COMPONENT({Name}) & "&dates=" & DATETIME_FORMAT({Start Date}, "YYYYMMDD") 
  & "%2F" & DATETIME_FORMAT(DATEADD({End Date}, 1, "day"), "YYYYMMDD")

Create a Google Calendar invite for a specific date and time:


"https://calendar.google.com/calendar/render?action=TEMPLATE&text="
 & ENCODE_URL_COMPONENT({Name}) & "&dates=" & DATETIME_FORMAT({Start Date/Time}, "YYYYMMDDTHHmmss") 
 & "Z%2F" & DATETIME_FORMAT({End Date/Time}, "YYYYMMDDTHHmmss") & "Z"

Open a JIRA ticket

"https://airtable-jira.atlassian.net/secure/CreateIssueDetails!init.jspa?pid=" 
   & ENCODE_URL_COMPONENT({Project ID}) & "&issuetype" & ENCODE_URL_COMPONENT({Issue Type}) 
   & "&summary=" & ENCODE_URL_COMPONENT({Summary}) & "&priority=" & ENCODE_URL_COMPONENT({Priority}) & "&duedate=" & DATETIME_FORMAT({Due Date}, "MM-DD-YYYY") & "&assignee=" & ENCODE_URL_COMPONENT({Assignee})

Post a Tweet

"https://twitter.com/intent/tweet?text=" 
& ENCODE_URL_COMPONENT({Tweet Text})

Open in page designer

This action opens a page designer extension and immediately jumps to the record the button was clicked from.

When an action is to open an extension, you will be prompted for the extension you wish to open. Selecting a dashboard will then change the list of available extension in the selection list. From here you can select an existing extension or install a new one that corresponds to the selected action from this menu.

4414861543191appbutton.jpg

This will switch the page designer extension's source view to the view the button was clicked from, but this setting is local to the your browser and will not affect other collaborators.

360076233054Image2020-06-25at90450AM.png

Run script

This action opens a scripting extension and runs the script.

When an action is to open an extension, you will be prompted for the one you wish to open. Selecting a dashboard will then change the list of available extension in the selection list. From here you can select an existing extension or install a new one that corresponds to the selected action from this menu.

1500000735382script.png

When a script is run from a button, the first input.recordAsync call will use the record the button was clicked from, instead of prompting you to choose a specific record.

To try this out yourself, copy the following code and change the table name and field name to ones in your base.

// Change these to match your base.
let table = base.getTable('Table name');
let field = table.getField('Field name');

// When run from a button field, the script skips the prompt
// and automatically uses the button's record.
let record = await input.recordAsync('Choose a record', table);

let cellValue = record.getCellValue(field);
output.markdown(`# You have selected ${value}.`);

Preview URL

This action opens a URL preview extension and displays the embed for the record the button was clicked from.

360099626934preview.png

To use this action, you can enable the “Use a specific field for previews” setting in the extension and choose the field that contains the URL you want to preview. This allows the URL preview extension to be used in non-grid views like gallery and kanban.

360077408413Image2020-06-25at101416AM.png

360076241734Image2020-06-25at101014AM.png

Send email with SendGrid

This action opens a SendGrid extension and fills the email template with data from the record the button was clicked from.

360101839233sendgrid.png

If the extension has not been set up correctly (e.g. no “To” email field set), the email template screen will be shown. Otherwise, you will see the preview screen where you can confirm the email before it is sent.

360077406473Image2020-06-25at94610AM.png

Send SMS with Twilio

This button action opens the Send SMS extension and triggers a preconfigured SMS.

360101840613sendsms.png

When you click a button with this action configured, the Send SMS extension will open and you'll be able to preview your messages before sending.

1500000769421sendsms.png

You can learn more about configuring and using the Send SMS extension in this article.

Create document with Formstack

This action opens a Formstack Documents extension and creates a PDF or word document based on data in the record the button was clicked from.

1500000735642formstack.png

360077477953Image2020-06-25at43047PM.png

With the Create document with Formstack action, you can customize your button field to open up a Formstack Documents extension, and create a PDF or word document that merges information from the record you clicked into a template of your choosing.

360077472693Create-Formstack-doc-rental-agreement.gif

Attach stock photos with Pexels

You can already browse, search, and attach free high-quality stock photos from Pexels’ extensive collection to your records using the Pexels extension. With the button field, you can now make the process of sourcing and saving photos from Pexels even simpler.

1500000735662pexels.png

Clicking the button will automatically bring up the designated Pexels extension and, once you find and select a photo you like, attach that photo to the record associated with the button you pressed.

360077477273Find-photo-with-Pexels-gallery-view.gif

Open custom extension

When an action is to open an extension, you will be prompted for the extension you wish to open. Selecting a dashboard will then change the list of available extensions in the selection list. From here you can select an existing extension or install a new extension that corresponds to the selected action from this menu.

360101839393customapp.png

Open source record (Airtable Sync)

Adding an open source record button field to your synced table will create a unique link for each record in your destination base. This link allows collaborators in your base to access the specific matching source record in the source base, so long as they have permissions to the source base. In order to set this up, add a new field to the synced table in your destination base. Next, choose the button field option followed by the “Open source record” action.

360098001533OpensourcerecordGIF.gif

FAQs

Is the button field support in the mobile app?

The button field has limited support in our mobile app. For iOS, tapping the button opens the URL in version 3.1.4+. Open app actions aren’t supported. For Android, tapping the button opens the URL in version 1.5.2+ Adding a button field will crash apps on versions earlier than 1.3.3.


Was this article helpful?

What's Next