GUIDE: How to DELETE an Airtable Record with JavaScript or via API

  • 2 December 2021
  • 0 replies
  • 632 views

Userlevel 7
Badge +14

GUIDE: How to DELETE an Airtable Record with via API or with JavaScript

 

Tips and Inspiration contributed by: Troy Tessalone - Automation Ace

 

UPDATES

Even easier now with these Airtable Actions (Authentication and Headers handled automatically):

  1. API Request
  2. Custom Action

 

API

Here’s how to use it in a Zap with the Webhooks app: https://zapier.com/apps/webhook/help

NOTE: Make sure to add the Authorization header with your API Key.

NOTE: Make sure to replace these values in the URL including the encased brackets []

  1. BASE_ID
    1. See reference: https://support.airtable.com/hc/en-us/articles/4405741487383-Understanding-Airtable-IDs
  2. TABLE_ID
    1. See reference: https://support.airtable.com/hc/en-us/articles/4405741487383-Understanding-Airtable-IDs
  3. RECORD_ID
    1. This should a dynamically mapped variable from a previous step

 

JavaScript

Here’s the JavaScript Code for using in a Run Script action of an Airtable Automation: https://support.airtable.com/hc/en-us/articles/360051792333-Run-a-script-Action-

 

INPUTS

  1. Table
    1. The Name or ID of the Table
  2. RecordID
    1. The variable for the ID of the Record

 

let config = input.config();
let Table = config.Table;
let RecordID = config.RecordID; // Record ID

// Delete a record in the Data table
let table = base.getTable(Table);
await table.deleteRecordAsync(RecordID);

 


0 replies

Be the first to reply!

Reply