Using a Script to Create a record in another base

Question for the community: is it possible to write a script that creates a new record in a table from a different base?
Basically I would like to create a button in a few different tables from various bases that, when triggered, runs a script that creates a new record in a table (with some specific fields copied over) in a separate base.

Is something like this possible in Airtable?

Hi @Josh_Kurz - you can’t do this directly/wholly in the scripting app as the scope of this app is the base that the script runs in. However, you could have a script in Base A use the REST API to create a record in Base B.

1 Like

This is was I’m trying to achieve also, do you have any form of example?

const newRecords={records:[
    {fields:{"Name": "record5", "Notes": "Test NEW created"} },
    {fields:{"Status": "Todo","Email": ""} }
const options={
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer '+ RO_KEY},
    body: JSON.stringify(newRecords)

//Test Api
const TAB_PATH='';
let word=TAB_PATH//+`view=Grid%20view`;
//let word=TAB_PATH+``
let response = await remoteFetchAsync(word, options)

const pageSummary = await response.json();
output.inspect(pageSummary); //for debug
1 Like

@Alexey_Gusev this is great!
Does this method work with a batch create? or will i have iterate API calls?

The first argument should be an array of up to 10 record objects. Each of these objects should have one key whose value is an inner object containing your record’s cell values, keyed by either field name or field id.

Returns an array of record objects created if the call succeeded, including record IDs which will uniquely identify the records


Thanks @Alexey_Gusev!

If I copy your syntax it works but whenever I attempt to pass this:

{"0":{"fields":{"Creative_Name":"Audio Produced : PRE+POST – ",

"1":{"fields":{"Creative_Name":"Audio Scripted : PRE+POST – ",

"2":{"fields":{"Creative_Name":"Promo 1 : POST – ",

"3":{"fields":{"Creative_Name":"Trailer : PRE – ",

I get a status: 422 “Unprocessable Entity” … is it the index numbers?