Jan 13, 2023 04:45 PM
Is there a way to loop through each record found from the Find Records action, and perform a subsequent action for each individual record? As far as I can tell, you can only do something with the list of record IDs that result. I can think of workarounds but they are extremely complicated and I figured I'd ask to see if there's something a little more proprietary.
Jan 13, 2023 06:24 PM
Hey @mimen1994!
As of right now, there isn't a way to iterate through a collection of records using the built-in automation actions.
With that being said, depending on how many records you're working with and the complexity of what you're trying to do, you can pretty easily script the actions you're trying to take on the records.
For example, if you wanted to create new records for each record, you can get away with a quick script like this:
const config = input.config();
const { records } = config;
const tableId = "yourTableId";
const table = base.getTable(tableId);
for (let i = 0; i < records.length; i++) {
await table.createRecordAsync({
"field1": "value",
"field2": "value",
"field3": [{id: "value"}],
"field4": {name: "value"},
"field5": new Date()
});
};
For the record, if you are actually considering scripting, I should mention that you want to use the createRecordsAsync/updateRecordsAsync methods in order to conduct bulk record operations. Take the code snippet above as just an example.
Now, there's another alternative that can be found in an automation tool like Zapier or Make. This is probably your best option if you have no desire to get a bit hands on in the scripting solution.
Assuming you're not already an existing user, I recommend Make over Zapier.
Jan 14, 2023 06:50 AM
Hi,
worikaround exist - you should create linked field, select "new table" and new tables with a single record will be created. You then put array of IDs received from 'Find records' to that single record link field and create second automation reacting on change in link field of your first table.
Feb 09, 2024 01:08 PM
For anyone finding this, Airtable now supports this with their Repeating Groups function: https://support.airtable.com/v1/docs/repeating-groups-of-automation-actions