Help

Re: Getting error while inserting Multiple Select Data from Retool

1478 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Samundra_Shahi
4 - Data Explorer
4 - Data Explorer

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 }"

Things I already tried but didn’t work:

Using “typecast”: true as I found in other answers.

It gives another set of errors. Looked everywhere but could not find the solution. Thanks.

1 Reply 1

Welcome to the community, @Samundra_Shahi! :grinning_face_with_big_eyes: I’m not familiar with Retool, but under the hood Retool is (most likely) using Airtable’s REST API to change things, so you need to ensure that the data is valid based on that API’s requirements. For a multiple-select field, you need to pass an array of strings, and it looks like Retool is creating a single string that contains all of the items:

"Standard Selection,Premium Selection"

I’m not sure what kind of data-manipulation features Retool gives you, but I’m hoping that it has a basic string split feature to turn a string into an array. In short, split that string by commas, which should create an array something like this:

["Standard Selection","Premium Selection"]

This split operation would be safe to run on single choices as well, as it would create a one-item array. (Apparently Airtable has been auto-converting a string with a single choice into a one-item array on its side of things, which is why you haven’t had any errors in that situation, but it’s still best to structure the data as Airtable prefers.)