Function parameters as JSON key in Node.js

Hello, How do I pass function parameters as JSON field name for updating fields in Airtable using Airtable REST API and Node.js?

The code

const updateField = async (id, field_name, updateValue) => {

  base('table_name').update([
    {
      "id": id,
      "fields": {
        field_name: updateValue
      }
    }
  ], function (err, records) {
    if (err) {
      console.error(err);
      return;
    }
  });
}

Is this what you need?
[field_name]: updateValue

1 Like

Works!
Thank you for pointing out the silly mistake!

1 Like

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.