Help

Pause or Delay in Automations

Topic Labels: Automations
Solved
Jump to Solution
24825 24
cancel
Showing results for 
Search instead for 
Did you mean: 
egordin
7 - App Architect
7 - App Architect

Is it possible to delay an action from happening? I really like Slack notifications for new records, but I’d like the action to wait say, 1 minute after the record is created so that I can finish adding all of the fields. Is that possible?

24 Replies 24

Wow, came here just to say this was a fantastic fix, thank you so much!! I didn't want to create any new views, so I followed your suggestion here to create a few hidden sequential check/unmark fields. Just FYI if anyone reads this later, if you create just 1 automation to check all the delay fields, it's still too fast, so you need at least a few automations, each checking a single field, for it to delay enough (ofc depends on what your delay is for. In my case, I needed to wait for a simple addition to occur)

magicalpotion
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi @egordin,

To set a delay in an automation script, simply use this code snippet into a Script:

let delay      = 10;
let date_start = new Date();
let date_end   = new Date();
date_end.setSeconds(date_start.getSeconds() + delay);
while(Date.now() < date_end.getTime()) {}

It is self explanatory. You define your delay and you're ready to go. Bear in mind as @kuovonne stated that Scripts are limited to 30 seconds run time. Two options to address this:

  • Chain multiple Script with the same code snippet. Really dirty but well it may work for cases where you need max 1 to 2 minutes delay.
  • Use groups to loop over

Hope it helps. Cheers.

J. Manuel - Magical Potion

Magical Potion - Crafting digital magic for your business

My original comment was several years ago, and Airtable has changed some things since then.
- Attachment URLs in formula fields no longer work the way they used to. Looking for a value in an attachment field via a formula field may work differently.

- I currently discourage using NOW() in formula fields. NOW() tends to be resource intensive, which can slow down a base.

- There are many different possible "delay/pause" scripts available, including the one that J. Manuel posted. They all use more-or-less the same principle. It is possible to chain them together to get a longer delay. However, using repeating action groups will not increase the delay because different iterations of the loop can run in parallel, and there currently is no way to have a final action after all the loops are done.

- If you use a "delay/pause" script, and you want the most recent record values, you will need to do a fresh read of the record to get updated values.

magicalpotion
5 - Automation Enthusiast
5 - Automation Enthusiast

@kuovonne It all depends on what type of delay/pause @egordin in order to fit his use case:

  • Using an automation script: then I would recommend my solution
  • Using a field: we could use some sort of NOW(). The usage of NOW() definitely depends on the number of records of your current table

Other solutions exist based on Views which are also elegant. Will also depends if you're working in the data vs the interface view.

J. Manuel - Magical Potion

Magical Potion - Crafting digital magic for your business

One of things I like about Airtable is that there are usually multiple ways of doing things. I find it interesting to see new and unique ways of solving problems. Each user can decide what makes the most sense for his situation. 

As for using NOW(), I still generally like to avoid it as a practice even when there are not many records in a table. It also isn't very accurate.