Sep 14, 2020 11:06 AM
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?
Solved! Go to Solution.
Jan 05, 2024 11:29 PM
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)
Oct 02, 2024 06:43 AM
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:
Hope it helps. Cheers.
J. Manuel - Magical Potion
Oct 02, 2024 09:37 AM
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.
Oct 03, 2024 12:25 AM
@kuovonne It all depends on what type of delay/pause @egordin in order to fit his use case:
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
Oct 03, 2024 09:50 AM
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.