Hi. I would like to create a template script that will create a bunch of rows for me.
Two fields in my table are single select fields. The fields are ‘Type’ and ‘Image Order’.
How do I choose existing values in those fields? See my code below.
I’m getting the following error:
Error: Can’t create records. invalid cell value for field ‘Type’. Cell value has invalid format: must be an object Single select field value must be an object with at least one of ‘id’ or ‘name’ as a property.
// Create three records in the Vendors and Contacts table
let table = base.getTable("Detail Page Resources");
let recordIds = await table.createRecordsAsync([
{
fields: {
'Type': 'Primary Image',
'Image Order': '1',
},
},
// Specifying an empty fields object will create a new record with no cell values set
{
fields: {},
},
]);
output.text("Created " + recordIds.length + " records!");
//Field 'Type' id is fldulSwbmghIAHeUU
//Primary Image single select id is selvmIA08iXpZt3ba