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();
output.set(’’,${inputConfig.FistName}
);
let fn_var = ${inputConfig.FistName}
;
output.set(’’,${inputConfig.Surname}
);
let sn_var = ${inputConfig.Surname}
;
output.set(’’,${inputConfig.StartDate}
);
let sd_var = ${inputConfig.StartDate}
;
output.set(’’,${inputConfig.StartLocation}
);
let sl_var = ${inputConfig.StartLocation}
;
output.set(’’,${inputConfig.LineManager}
);
let lm_var = ${inputConfig.LineManager}
;
output.set(’’,${inputConfig.JobTitle}
);
let jt_var = ${inputConfig.JobTitle}
;
output.set(’’,${inputConfig.PersonalEmail}
);
let pe_var = ${inputConfig.PersonalEmail}
;
output.set(’’,${inputConfig.EmploymentType}
);
let et_var = ${inputConfig.EmploymentType}
;
var Airtable = require(‘airtable’);
var base = new Airtable({apiKey: ‘’}).base('’);
base(‘IT-SL’).create(t
{
“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) {
console.error(err);
return;
}
records.forEach(function (record) {
console.log(record.getId());
});
});
And this is the error:
ReferenceError: require is not defined
at main on line 19