Create a records from data in another base

Hi, I’ve trying to create an automation that will create a record in one base from and automation in another base, while I understand scripts as base bound I also understand I can do this wit the API.

So I’ve been looking at the API ref and it give you the basic JAVA to do this but!

The Code:

let inputConfig = input.config();
let fn_var = ${inputConfig.FistName};
let sn_var = ${inputConfig.Surname};
let sd_var = ${inputConfig.StartDate};
let sl_var = ${inputConfig.StartLocation};
let lm_var = ${inputConfig.LineManager};
let jt_var = ${inputConfig.JobTitle};
let pe_var = ${inputConfig.PersonalEmail};
let et_var = ${inputConfig.EmploymentType};

var Airtable = require(‘airtable’);
var base = new Airtable({apiKey: ‘’}).base('’);

“fields”: {
“First Name”: fn_var,
“Start Date”: sd_var,
“Start Location”: sl_var,
“Surname”: sn_var,
“Line Manager”: lm_var,
“Job Title”: jt_var,
“Personal Email”: pe_var,
“Employment Type”: et_var,
“Location”: sl_var
], function(err, records) {
if (err) {
records.forEach(function (record) {

And this is the error:

ReferenceError: require is not defined
at main on line 19

Hi @IT_Departmenrt - it looks like you are mixing code for an external REST API call and an “internal” script that you might use in an automation or script block. Have a look here for the internal scripting documentation:

Or take a look at my blog where I have written up some practical scripting examples.

The error message you are getting relates to these lines:

var Airtable = require(‘airtable’);
var base = new Airtable({apiKey: ‘’}).base('’);

You don’t need to bring in the API client on scripts or automations so these lines are not required (but just removing these probably won’t fix your errors - there’s more going on there).

Follow up - if you want to create records in another base using the REST API, don’t use the Airtable client (as above), but use vanilla JS code, e.g. fetch to POST to your second base.