Help

Re: Updating field in mutliple records with automation

2012 0
cancel
Showing results for 
Search instead for 
Did you mean: 
David_B
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi all,

I am working on an automated email unsubscriber that uses an email in a new view to trigger an automation to find all the records in the original data (same base) with the same email address. Once found the Field Unsubscribed should automatically be changed to: “Yes.” The issue arises, seemingly, when multiple records pop up with the same email. Theoritically, the automation should upate 1 record or a 100, but in practice I get an error on this - UPDATE step.

image

Pls advise what I should populate into the Record ID field of the automation. I’ve used the first option: “Make a new list of Record IDs” but that is the one that errored out.

Thanks,
David

P.S. the error is: “Received invalid inputs.”

5 Replies 5

No it shouldn’t. It is a feature we all want, but that is not how the action steps in Airtable’s automations are designed. The “Update record” step is singular for a reason: it is designed to update a single record.

If you need to update/create/delete multiple records you should pass the List of record IDs to a “Run a script” action instead. Scripts can perform batch updates while the “Update/Create a record” steps cannot.

Hi Kamille, thank you. Are you able to share a simple script that would update Field X with a new value: “Yes”?

I’d greatly appreciate it.

Best,
David

it’s possible to perform no-code solution, with other table linked to ‘data’ - you update a single record, linked field, and put your list of ID inside, ‘mark’ a number of records. Each record will get this link in it’s field.
Then second automation should do your action with every ‘marked’ record.
On my opinion, it’s worse option.

for scripting, here’s my template

const table=base.getTable('test1');const fl='Calculation'
const upd=await table.selectRecordsAsync({fields:[fl]}).then(q=>q.records.map(r=>({'id':r.id,'fields':{[fl]:'yes'}})))
while(upd.length) await table.updateRecordsAsync(upd.splice(0,50))

but you don’t need to await and select records (that part: await table.selectRecordsAsync({fields:[fl]}).then(q=>q.records.), you need to change it by array you get in previous step and access it via input.config()

David_B
5 - Automation Enthusiast
5 - Automation Enthusiast

Alexey, thank you so much, though I must admit I was a bit overwhelmed with your answer and implementation is above my skillset.

I ended up using Zapier to accomplish the same task, by repeatedly looking for records that FAILED to meet my criteria in an AirTable view. After every record was marked, there were none left in the view that met the criteria, and all was right with the world.

Thank you @Kamille_Parks and @Alexey_Gusev for your help!

Kai_Muscher
6 - Interface Innovator
6 - Interface Innovator

Hi David,

I am exactly facing similar challenges and found your post when looking for a solution. Seems we have to wait for this feature for a batch update. In combination with the new button feature (run automation) in interface designer I would be able to update linked records at one click. That was my plan. Hopefully we don’t have to wait for too long to get this running.

K