Airtable Update action is difficult to use, is there an easier way?

I’m having some difficulty properly using the Airtable update action. The key issue is that the way n8n builds the request to the Airtable API when you have “update all fields” enabled on the node is it looks each field in the input data and adds it to request body. This is fine but if you’re updating you also need the record id. So if I include the record id with the data in my workflow to keep things simple, it causes the Airtable update node to fail because it naively adds the “id” field to the request, but there is no field “id” on the table, I need to use it for the Id parameter on the node.

Based on this, I don’t see how it’s possible to use the “update all fields” option without intentionally removing the ID in some previous node, and then referencing that node directly from the Id parameter in an expression.

I suppose one solution would be, in addition to the option of specifically choosing which fields to use, give an option to choose fields to ignore. This way you could keep all the data together in the workflow and choose to ignore the id field for the fields to update, and use it directly from the input data in the Id paramter. Right now I would have to manually add every single field except the id field as ones I want to include, which is tedious when you have many fields. This approach completes succesfully but never actually updates the data in Airtable, but I don’t know if it’s an Airtable issue or an n8n issue. When I build a request manually and send it with curl, Airtable does update correctly.

Another option could be to treat a field of “id” as a reserved name and automatically use that as the ID for the request, but that’s also problematic if you actually do have a field called “id” on your table.

Am I missing anything here? Is the correct way to use the Airtable update action to remove the ID in a previous step, and then reference some other nod that happens to have that data for the Id parameter? I would share a workflow but I haven’t yet got this approach to work.

Thank you.

The easiest solution I’ve found is to get all my data as a flat object with the fields I want updated and the id all together, then pass it through a Function Item node with simply:

delete item.id
return item

and then on the Airtable node, refer back to the previous node that contains the data with the id for the Id parameter.

This seems wrong so if anyone knows a better way to do, I’d love to hear it, but this is working so hopefully it helps any future people if there is not a better way.

I had now a look at the code and you are totally right. Somebody (OK, it was me) did really not think that through. When I developed it, I had set the id directly to a fixed value (so no expression) and so worked totally fine. Makes now really not really any sense at all.

What you did is really the best way to make it work right now. Will add an optional ignore-option as you proposed, which will be available if “Update all Fields” is activated to make that functionality properly usable. I will update here once it got released.

Sorry about that issue!

1 Like

Option got added and will be released with next version:
https://github.com/n8n-io/n8n/commit/5f2d528046064a3bc9e9304c1be857e58836ab19

Got released with [email protected]

1 Like