Scripting Automation: Linking new records created in automation to existing records

Hi, Airtable community!

I’m writing a script in the Automations tab. My first trigger creates a new record called newEntityId.
I want to link that newEntityId record to another record I’ve created in the script.

My problem is that you can only get the record ID from the newly created record and the field type I want to link to is “Link to another record” which requires the object/record type.

I’ve made a solution that works but throws an error. If the error could be solved, that would be appreciated!

new record:

error message:


let inputConfig = input.config();

let tasksTable = base.getTable("Tasks");
let taskQuery = await tasksTable.selectRecordsAsync();
let tasksrecords = taskQuery.records 

let tasksTemplate = base.getTable("Tasks Template");
let templateQuery = await tasksTemplate.selectRecordsAsync();
let tasksTemplateRecords = templateQuery.records;
let taskTemplateLength = templateQuery.records.length;  

//Create taskTemplate.length records in Tasks field AND add all tasks template to the array
let tasksArray = [];
for (let i = 0; i < taskTemplateLength; i++) {
  tasksArray[i] = await tasksTable.createRecordAsync({


let newEntity = [{
    id: inputConfig.newEntityId,
    name: "",

for (let i = 0; i < taskTemplateLength; i++) {
  await tasksTable.updateRecordsAsync([
      id: tasksArray[i],
      fields: {
        "Task": [tasksTemplateRecords[i]],
        "Entities": newEntity,  

Here’s where your problem lies. The correct format for creating a link to a record only includes the record ID. The “name” property that you added makes it invalid. This should work:

let newEntity = [{id: inputConfig.newEntityId}];
1 Like

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.