Nov 08, 2021 11:43 AM
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!`);}
Solved! Go to Solution.
Nov 08, 2021 12:24 PM
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}]
})
Nov 08, 2021 12:24 PM
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}]
})
Nov 10, 2021 04:43 AM
That was it, thanks!!