Airtable Script Error - Update Table Record when Interface button is pushed

213 3
Showing results for 
Search instead for 
Did you mean: 
5 - Automation Enthusiast
5 - Automation Enthusiast


I am looking for some help with correcting this script (I had Copilot AI help write it) for Airtable. I'd like for the  automation to tick a checkbox "Fully Live" in the table "App Status" when a button is pushed in a specific interface.

I'll attached screenshots of the script error, the table we'd like to have updated and the script itself. 

Any help would be greatly appreciated!

I am not married to having to use the button in the interface to initiate the automation. I have another table called Monthly RTLs where the button could be added. When I add a button field there, it wants me to add it to a Dashboard and I got confused - that's why the script references that table.


This is the script error. Airtablel Script Fully Live Error.png

 This is the interface associated to the Monthly RTLs Table.

Airtable Script Fully Live Error 3.png

 The field "Fully Live" lives in this table here called App Status. This is where all data for a record is held. My department primarily works off of this view and updates the table Monthly RTLs when a store is completed with all tasks.

Airtable Script Fully Live Error 2.png

// This script updates the "Fully LIVE" checkbox field in the "App Status" table
// when the "FULLY LIVE" button is pushed in the "Monthly RTLs" table.

// Define the base and tables
let base = await Airtable.base.fetch('YOUR_BASE_ID');
let appStatusTable = base.getTable('App Status');
let monthlyRtlsTable = base.getTable('Monthly RTLs');

// Define the button name and checkbox field name
let buttonName = 'FULLY LIVE';
let checkboxFieldName = 'Fully LIVE';

// Define the action to take when the button is pushed
let buttonPushed = async (event) => {
    // Get the record that was updated
    let record = await monthlyRtlsTable.selectRecordsAsync({
        fields: ['Name', checkboxFieldName],
        filterByFormula: `{${buttonName}} = '1'`,
        maxRecords: 1,
        sort: [{field: 'Created Time', direction: 'desc'}]

    // If there is a record that matches the filter, update the checkbox field in the App Status table
    if (record.records.length > 0) {
        let appStatusRecord = await appStatusTable.updateRecordAsync(record.records[0].id, {
            [checkboxFieldName]: true
        output.text(`The "${checkboxFieldName}" field in the "App Status" table has been updated to "true".`);
    } else {
        output.text(`No records in the "Monthly RTLs" table match the filter.`);

// Listen for the button to be pushed, buttonPushed);
3 Replies 3

> (I had Copilot AI help write it)

This is the source of your problem. AI isn't very good at writing Airtable scripts. In this case, the code you have is a mish-mash of code for scripting, code for using the Web API, and goodness knows what else.

On the other hand, why are you using a script at all? Your automation should be able to update a record without using scripting. Use an "Update Records" action.

I couldn't get it to work the way I wanted to using "update record". 

In "Monthly RTLs" table, we frequently have 2 entries for each "Store". One for app launched and another for website launched. 


So we need to be able to tell App Status when a store is "fully" live when certain criteria is met (not just being added to the Monthly RTLs view). Some Stores do just have a website (or app) and that would be considered "fully live", while others require both app and website to be considered "fully live".  

Do you have a solution for this?

What problem occured when using an “Update Record” action? Are you updating a linked record? Does the problem only occur when there are two linked records? If so, does the checkbox need to be updated in both linked records? In this situation, you should use a repeating action group to loop over the linked records and nest the update action inside the repeating action group. 

If you want to update only one of the linked records, you can try doing a Fond Records action to find only the one you want to update.