Getting error while inserting multiple select data into Airtable

Hello guys, I am trying to insert Multiple Select data into Airtable. When I select only ONE data, it successfully inserts it into Airtable. But selecting more than one data gives error. Yes, I have already checked and data is perfectly identical on both sides, not even a space difference.

(Note: I am not trying to insert new data, the same data is in the Airtable already)

Query:

mutation
{
insert_studentRecords(
studentPreferences: "{{student_preferences.value}}"
)
{
studentPreferences
}
}

Error:

"errors": [
{
"message": "Unexpected error value: { error: "INVALID_MULTIPLE_CHOICE_OPTIONS", message: "Insufficient permissions to create new select option \"\"Standard Selection,Premium Selection\"\"", statusCode: 422 }"

Thank you.

Hey @samundrashahi

I'm just going to give a guess here - I bet this is due to the extra quotations around {{student_preferences.value}}.

Could you try this query without that ?

1 Like

Hi there @samundrashahi. What is studentPreferences expecting as an input type? Looking at the error message it seems to be interpreting "Standard Select,Premium Selection" as one option as opposed to two, and throwing an error because that option doesn't exist. Perhaps, also, as @**JoeyKarczewski **mentioned, you'll need to remove the extra quotations.

Sorry for responding late, I was working on other parts of the project. When I remove the quotation it shows the below error.

Syntax Error: Cannot parse the unexpected character "/"."

My detailed scenario.

And here are the errors

{
"data": {
"insert_forDemoTable": null
},
"errors": [
{
"message": "Unexpected error value: { error: "INVALID_MULTIPLE_CHOICE_OPTIONS", message: "Insufficient permissions to create new select option \"\"Starter Pack,Premium Pack\"\"", statusCode: 422 }",
"locations": [
{
"line": 2,
"column": 3
}
],
"stack": [
"Error: Unexpected error value: { error: "INVALID_MULTIPLE_CHOICE_OPTIONS", message: "Insufficient permissions to create new select option \"\"Starter Pack,Premium Pack\"\"", statusCode: 422 }",
" at asErrorInstance (/var/app/current/node_modules/graphql/execution/execute.js:500:10)",
" at runMicrotasks ()",
" at processTicksAndRejections (internal/process/task_queues.js:95:5)",
" at async graphqlMiddleware (/var/app/current/node_modules/express-graphql/index.js:166:18)"
],
"path": [
"insert_forDemoTable"
]
}
]
}

Please help me through. Thank you.

Can you try declaring a variable for your mutation? Something like

mutation ($preferences: [String!]){
  insert_forDemoTable(studentPreferences1: $preferences){
    studentPreferences1
  }
}

This should create a variable field where you can pass {{student_preferences.value}}.