Help

Script for creating record with single select field is failing

Topic Labels: Automations
Solved
Jump to Solution
415 3
cancel
Showing results for 
Search instead for 
Did you mean: 
Ruchika_Abbi1
7 - App Architect
7 - App Architect

I have the following script to create records in a table. 
Event Name is a Single Select field. But I get an error "
Error: Field "...." cannot accept the provided value."

 

await passTable.createRecordAsync({
"Event Name": event,
"Event Date/Time": date,
"Notes": notes,
});
}

 

 
I tried: 

 

"Event Name": [{name: event.toString()}]

and 
"Event Name": [{name: event)}]

 

 

but neither of them work. Any suggestions? 

1 Solution

Accepted Solutions
TheTimeSavingCo
18 - Pluto
18 - Pluto

Single select fields expect `{name: [OPTION VALUE]}`, so try

"Event Name": {name: event.toString()}

 or

"Event Name": {name: event}

See Solution in Thread

3 Replies 3
TheTimeSavingCo
18 - Pluto
18 - Pluto

Single select fields expect `{name: [OPTION VALUE]}`, so try

"Event Name": {name: event.toString()}

 or

"Event Name": {name: event}

Hi,

I remember my beginner steps in Airtable JS, such explanation would be critical for me 🙂

Your answer is correct in final part, but I would better say
Single-select refuses to get  {name: [OPTION VALUE]}
because it's array.
Single-select expects a single object with Name 

 

{name: OPTION_VALUE}

 


The `{name: [OPTION VALUE]}`, Array of objects is the format for Multiselect, Linked field, Lookup (computed, can't write to it), multi-User. maybe something else.

I would suggest to take a look in this place for cell value problems with Create/Update fields
maybe it's difficult to understand the exact format, but it usually has good examples.

Alexey_Gusev_0-1728505248041.png

Another thing to check, chatGPT sometimes reply with a brilliant answer. And sometimes it's a nonsense formatted like brilliant answer. To fix a small part of script is easier that write new from scratch.

anyway, worth a try.


Ah! I see what I did wrong there🙈 Thanks!