Help

Re: Create Multiple Linked Records

Solved
Jump to Solution
2700 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Fernando_Valice
4 - Data Explorer
4 - Data Explorer

Hi Everyone!

Thanks for you time beforehand and apologies if this case was already resolved in another topic (altough I couldn’t find any similar). I am pretty new to airtable scripting and I hit a roadblock in one of my codes.

I need to iterate and create multiple linked records into a table, but my code is throwing me the following error “j: Can’t create records: invalid cell value for field ‘Property’.
Cell value has invalid format: .0.0 must be an object.
Linked records field value must be an array of objects with property ‘id’ corresponding to linked record id.”

I assume this is because I have to put some sort of id in the createRecordAsync function, but I am not sure how the syntax for that should be.

Full code:

let importTable = base.getTable('Master List');
let importView = importTable.getView('Active');
let importQuery = await importTable.selectRecordsAsync();
let newTable = base.getTable('New Table');

for (let record of importQuery.records) {
    let recordName = record.getCellValue('Name');
    await newTable.createRecordAsync({
        "Linked Field": recordName})
    output.text(`New record for ${recordName} created!`);}
1 Solution

Accepted Solutions
kuovonne
18 - Pluto
18 - Pluto

Welcome to the Airtable community!

When you create a new record the field values need to be in the proper write format. You can see the format for a linked record field in the documentation.

You probably want something like

    "Linked Field": [{id: record.id}]
})

See Solution in Thread

2 Replies 2
kuovonne
18 - Pluto
18 - Pluto

Welcome to the Airtable community!

When you create a new record the field values need to be in the proper write format. You can see the format for a linked record field in the documentation.

You probably want something like

    "Linked Field": [{id: record.id}]
})

That was it, thanks!!