Iterate over records in Airtable script

Do you want to learn how to iterate over records in Airtable? If so, this article is for you. You might need to iterate through records in many different situations, depending on your need. You can learn how to iterate through records in this article and you can apply it based on your conditions. I am going to use Airtable automation which is triggered when the status of a record is updated. Let's go through the current base, after which we can continue learning further.

I have two tables in my example base:

  1. Projects
  2. Tasks

The Project and Tasks tables are connected with a linked record field. The functionality in this example is that whenever the status in the Tasks table is updated, the script should run and update the project's status. There are two status options: 1) Working and 2) Finished. If any status is 'Working' out of all tasks that are related to that project, then it flags the connected Project's table record to 'Working'. If all tasks are finished, then it should update the project record to 'Finished'. This logic of course can be extended to other status options as well.

Let's set up the Automation

  • Click on the automation icon on the top right corner of your Airtable base screen.
  • Then set the trigger to 'When record is updated' and choose the table and field you would like to monitor
  • Now set 'Run a Script' as action.
  • Click Here to get the script that I have used.
  • Turn on the automation and you are all set.

Now whenever the status is updated in the Tasks table, it will trigger the script which will update the status of the Project table records. To configure your automation, you can refer to the image below.

airtable records iterate over records in airtable script programmatically loop through all fields in a record how to iterate over records in airtable update multiple records in airtable delete multiple records in airtable go through records in airtable

Script Explanation

  • Let's go over what our script is doing.
  • First, the script gets the data from the Tasks table.
  • Then it goes through it and returns data in a format that Airtable accepts to update the records.
  • Next, the script is filtering the records.
  • And finally it updates the data.

Feel free to contact me for a Free airtable consultation by Clicking Here.

monino solutions logo

COPYRIGHT © 2024 Monino Solutions.