Help

Re: How to schedule an automation?

3144 0
cancel
Showing results for 
Search instead for 
Did you mean: 
LukaszWiktor
6 - Interface Innovator
6 - Interface Innovator

I wanted to share what I figured out looking for a way to run an automation at a scheduled time.

First, create a helper table named Automation Trigger with 3 columns:

  1. Name (type: Single line text)
  2. Run At (type: Date, with time field included)
  3. Record (type: Formula, expression: RECORD_ID())

image

For each automation you want to schedule:

  1. Add a row with a unique descriptive name
  2. Add a view with a filter matching only the one record added above (Name is …)

image

Add an automation:

  1. Choose trigger: When record updated
  2. Select table: Automation Trigger
  3. Select view: the one matching your automation intent
  4. Select the Run At field.
  5. Run test
  6. Add an action according to your needs

image

Finally, the scheduling piece. You’ll need Integromat or Zapier. Zapier allows to schedule a task only at a selected hour. Whereas Integromat is much more flexible. For example, you can schedule an action at regular intervals.

image

  1. Connect Integromat to your Airtable account
  2. Select Update a record action
  3. Select your base and the Automation Trigger table
  4. Copy a Record Id from the row in the Automation Trigger table that is matching your automation intent
  5. In the Run At field, add a formula now

image

That’s it. Integromat will update the record in the Automation Trigger table at the specified schedule what in turn will trigger your automation in Airtable.

I’m looking forward to your feedback. Is there a way to simplify this solution?

12 Replies 12

Thank you @kuovonne.
Wasn’t aware of the hourly updates when the base is closed.

Hi Justin,
I’m looking to do something similar, I want to run an automation every 2 hours, where every record that matches the conditions within the last 2 hours will be emailed as a grid.

Details are:
When field ‘notification type’ is ‘non-urgent’ (this is a single select field)
Send email including a grid of all non-urgent records.
I want this to run every 2 hours, and only send records that match the condition since the automation last ran. If no records match the condition

Are you able to help with that?

At the moment if I try run at a scheduled time, it will send an email of all records that match the condition, not just the ones that have been updated to match it since the automation last ran.

You didn’t mention what workspace plan your base is in, so I’m not sure if you can use scripting in your automations. I’ve got an idea for a way to pull this off without scripting, but it’s imprecise because it relies on comparing against the NOW() function. That function’s output only updates on certain intervals—roughly every 15 minutes if the base is open, and every 60 minutes if it’s closed—so it’s possible that some records would be missed.

If your base is in a Pro-plan workspace or higher, you could modify your “Find records” action condition to find records that are not marked a certain way—e.g. with a check in a {Notified} checkbox field—insert those records into the email, and then use a “Run a script” action to mark them so that they’re ignored the next time around:

Screen Shot 2022-07-18 at 4.50.48 PM

const {recordIds} = input.config()
const table = base.getTable("Table Name")
const updates = recordIds.map(id => ({id, fields: {"Notified": true}}))
while (updates.length) await table.updateRecordsAsync(updates.splice(0, 50))