Update record

Script airtable Verified

by paulpyreneene ยท 6/6/2022

The script

Submitted by hugo697 Deno
Verified 376 days ago
1
import { Airtable } from "https://deno.land/x/airtable/mod.ts";
2

3
type Airtable = {
4
  apiKey: string;
5
};
6
type AirtableTable = {
7
  baseId: string;
8
  tableName: string;
9
};
10
export async function main(
11
  atCon: Airtable,
12
  atTable: AirtableTable,
13
  recordId: string,
14
  newRecord: object,
15
) {
16
  const airtable = new Airtable({...atCon, ...atTable});
17

18
  const updateSingleRecord = await airtable.update(recordId, newRecord);
19

20
  return updateSingleRecord;
21
}
22

Other submissions
  • Submitted by rossmccrann Deno
    Created 1009 days ago
    1
    import { Airtable } from "https://deno.land/x/airtable/mod.ts";
    2
    import { Fields } from "https://deno.land/x/airtable/mod.ts";
    3
    
    
    4
    type Airtable = {
    5
      apiKey: string;
    6
    };
    7
    export async function main(
    8
      at_con: Airtable,
    9
      recordId: string,
    10
      newRecord: object,
    11
    ) {
    12
      const airtable = new Airtable(at_con);
    13
    
    
    14
      const updateSingleRecord = await airtable.update<Fields>(recordId, newRecord);
    15
    
    
    16
      return { message: "Updated single record in table" };
    17
    }
    18