Help

Creating options in Multiselect with typecast = true with API

Topic Labels: API
876 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Devon_Stanton
5 - Automation Enthusiast
5 - Automation Enthusiast

I'm writing a script that will update my airtable dynamically with new tags that will sit in a multi-select field. I know that I can use { typecast: true } in my call to airtable, but I'm still getting an issue when updating it. I'm pretty sure the issue is either in how I've set up my object for Airtable or the placement of the { typecast: true } option. 

Here is the partial method that creates a record in my airtable

 

await this.table.create(
          batch, // batch of records to be updated, see below for structure
          { typecast: true },
          function (err, record) {
            if (err) {
              console.error(err);
              return;
            }
            console.log(record.getId());
          }
        );

 

Here is the object (batch) that I'm sending through

 

fields: {
      name: 'a new record',
      categories: [
          { name: 'Item 1' },
          { name: 'Item 2' },
          { name: 'Item 3' },
          { name: 'Item 4' },
          { name: 'Item 5' }
      ]
    }
  }​

 

And the error I receive is this:

 

AirtableError {
  error: 'INVALID_VALUE_FOR_COLUMN',
  message: 'Cannot parse value for field categories',
  statusCode: 422
}

 

0 Replies 0