Help

Create a record without Linked Data throws Error

484 1
cancel
Showing results for 
Search instead for 
Did you mean: 
rsharma13
4 - Data Explorer
4 - Data Explorer

Hello, 

I am trying to write an Airtable automation Script where I am trying to create a new record to an existing table that has 4 fields

  • Friendly Name (String)
  • Platform Name (String)
  • Platform Type (Prefixed Value)
  • Data (Self-reference Linked Records field)

 

When I run this code where I am setting all the values except the "Data" field because I don't want the new record to be linked to any other record

 

 

 

const data = {
"Friendly Name": d,
"Platform Name": d,
"Platform": {name: "Launch"},
}
const record = await table.createRecordAsync(data)

 


I keep getting the same error

 

ERROR
Error: Field "fldtUMUOntLLXvVx8" cannot accept the provided value.
    at <anonymous> on line 121
    at <anonymous> on line 137
    at main on line 43

 

 

where fldtUMUOntLLXvVx8 is the field ID for the "data" field. 

 

Can someone help me understand what I am doing wrong. I just want to create the new record without any interlinking

1 Reply 1
Arthur_Tutt
8 - Airtable Astronomer
8 - Airtable Astronomer

Hey @rsharma13 ! Great question. The error you're getting is a data type error b/c airtable doesn't understand the data you're trying to input to create a new record. Here's a quick Loom Video I recorded to show you step by step how I'd solve this. 

Clarification: When you say a prefix value do you mean a Single Select Field? This is an important distinction. 

To create new records with a single select you'll need to pass both  the Name AND ID ie: 

 

{
  id: "selTK7GUxsdiB6ss6",
  name: "Launch"
 }

 

 

To find the Name and ID of your single select fields you can use this script (remember to change my table / field / record ID variable names to match yours)

 

 

var recordsTable = base.getTable("Records")

var recordsSelect = await recordsTable.selectRecordAsync("recwIxFLjepJ0444Z")

console.log(recordsSelect)

var recordsRecords = recordsSelect.getCellValue("Platform Type");
console.log(recordsRecords)

 

 

Expected output:

Screenshot 2023-11-11 151029.png