Skip to main content
Solved

Pause or Delay in Automations


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?

Best answer by ScottWorld

Instead of using a “New Record” trigger, change your trigger to “New Record In View”.


Then, you could create some sort of a criteria (such as checking a checkbox, or a formula that yields a value after a certain amount of time has passed since the creation date) to make your record appear in the view.


When your records appears in the view, the automation will trigger.

View original
Did this topic help you find an answer to your question?

24 replies

ScottWorld
Forum|alt.badge.img+20
  • Brainy
  • 8713 replies
  • Answer
  • September 14, 2020

Instead of using a “New Record” trigger, change your trigger to “New Record In View”.


Then, you could create some sort of a criteria (such as checking a checkbox, or a formula that yields a value after a certain amount of time has passed since the creation date) to make your record appear in the view.


When your records appears in the view, the automation will trigger.


kuovonne
Forum|alt.badge.img+17
  • Brainy
  • 5987 replies
  • September 14, 2020

You can also use the When a record matches conditions trigger. It is similar to the New Record in View trigger, without having to actually create a view. Note that you may still have to deal with a record meeting conditions before you finish entering the data, especially with text fields and numeric fields.


  • Author
  • Known Participant
  • 73 replies
  • September 15, 2020

Thank you @ScottWorld and @kuovonne! Both of these are excellent solutions. I really appreciate your help!


  • Inspiring
  • 14 replies
  • September 18, 2020
ScottWorld wrote:

Instead of using a “New Record” trigger, change your trigger to “New Record In View”.


Then, you could create some sort of a criteria (such as checking a checkbox, or a formula that yields a value after a certain amount of time has passed since the creation date) to make your record appear in the view.


When your records appears in the view, the automation will trigger.


Can you explain this in greater detail please? How do you create a formula that yields a certain value after, for example, 1 minute passes? I know you can reference CREATED_TIME() and NOW() but my understanding is that NOW() only updates when you manually change the record.


ScottWorld
Forum|alt.badge.img+20
  • Brainy
  • 8713 replies
  • September 18, 2020
Mike_Mauer wrote:

Can you explain this in greater detail please? How do you create a formula that yields a certain value after, for example, 1 minute passes? I know you can reference CREATED_TIME() and NOW() but my understanding is that NOW() only updates when you manually change the record.


Good question — it looks like they’ve changed the behavior of the NOW() functionality, and that it no longer is designed to update continuously in the background. So I wouldn’t depend on that.


At the moment, I would trigger your automation based on something else instead of time.


  • Inspiring
  • 14 replies
  • September 18, 2020
ScottWorld wrote:

Good question — it looks like they’ve changed the behavior of the NOW() functionality, and that it no longer is designed to update continuously in the background. So I wouldn’t depend on that.


At the moment, I would trigger your automation based on something else instead of time.


To open the question back up here since the previous solution isn’t applicable anymore - Does anyone know any way to delay an action?


The most obvious use-case here is how Automations might handle image attachments. It takes ~15-30 seconds for an image to upload, however a placeholder (a generic thumbnail image) is uploaded immediately.


The issue here is that you can’t sequence automations involving uploading image attachments. Normally you would do “[Image attachment field] is not Blank” to trigger the next action after the image uploads, but due to the placeholder image that’s added, it ends up triggering immediately.


To be more specific to my use case - you can’t issue a simple (1) “Upload URL to attachment field” > (2) “Post that attachment to Facebook” automation since the “Post to Facebook” automation triggers as soon as step 1 starts, not finishes.


So the solution would be to delay Step 2 by 30 seconds or so to ensure the image upload finishes first.


Things that I have tried:




  • Creating a date/time field that is offset by 1 minute so the triggers for the 2 automations are staggered. However, view filters and trigger conditions only give you the option of filtering by Day (e.g. “before Today”, etc), but not by time (e.g. “before Now”).




  • Using NOW() is not applicable for the reason mentioned in a previous post. NOW() only updates once the record is viewed or edited, not in real-time.




  • SetTimeout() is a Javascript function that can be used to write a delay script. However that command is not recognized or accepted by Airtable Scripting for some reason and just throws an error.




  • As mentioned above, simply sequencing it by saying “After the image attachment field is NOT blank, run Step 2” doesn’t work because the image attachment field adds a placeholder while uploading which triggers Step 2 immediately.




This does seem to be a fairly large limitation since there are 4 acceptable solutions above but none of them actually work.


I hope someone has a solution, since being able to simply delay an automation by X seconds seems like a fairly standard use-case.


ScottWorld
Forum|alt.badge.img+20
  • Brainy
  • 8713 replies
  • September 18, 2020
Mike_Mauer wrote:

To open the question back up here since the previous solution isn’t applicable anymore - Does anyone know any way to delay an action?


The most obvious use-case here is how Automations might handle image attachments. It takes ~15-30 seconds for an image to upload, however a placeholder (a generic thumbnail image) is uploaded immediately.


The issue here is that you can’t sequence automations involving uploading image attachments. Normally you would do “[Image attachment field] is not Blank” to trigger the next action after the image uploads, but due to the placeholder image that’s added, it ends up triggering immediately.


To be more specific to my use case - you can’t issue a simple (1) “Upload URL to attachment field” > (2) “Post that attachment to Facebook” automation since the “Post to Facebook” automation triggers as soon as step 1 starts, not finishes.


So the solution would be to delay Step 2 by 30 seconds or so to ensure the image upload finishes first.


Things that I have tried:




  • Creating a date/time field that is offset by 1 minute so the triggers for the 2 automations are staggered. However, view filters and trigger conditions only give you the option of filtering by Day (e.g. “before Today”, etc), but not by time (e.g. “before Now”).




  • Using NOW() is not applicable for the reason mentioned in a previous post. NOW() only updates once the record is viewed or edited, not in real-time.




  • SetTimeout() is a Javascript function that can be used to write a delay script. However that command is not recognized or accepted by Airtable Scripting for some reason and just throws an error.




  • As mentioned above, simply sequencing it by saying “After the image attachment field is NOT blank, run Step 2” doesn’t work because the image attachment field adds a placeholder while uploading which triggers Step 2 immediately.




This does seem to be a fairly large limitation since there are 4 acceptable solutions above but none of them actually work.


I hope someone has a solution, since being able to simply delay an automation by X seconds seems like a fairly standard use-case.


Actually, I was slightly incorrect, due to incorrect information that Airtable has listed on their formula reference page. The NOW() and TODAY() functions WILL update silently on their own in the background, every 7-15 minutes.


However, if you’re really looking for accurate scheduling & timing of your automations, I would recommend taking a look at Integromat, which has excellent scheduling features.


I’m sure other people will have some ideas for you as well.


But — couldn’t you just check a checkbox when you’re ready for the record to be sent through your automation? That’s the easiest way to do it.


  • Inspiring
  • 14 replies
  • September 18, 2020
ScottWorld wrote:

Actually, I was slightly incorrect, due to incorrect information that Airtable has listed on their formula reference page. The NOW() and TODAY() functions WILL update silently on their own in the background, every 7-15 minutes.


However, if you’re really looking for accurate scheduling & timing of your automations, I would recommend taking a look at Integromat, which has excellent scheduling features.


I’m sure other people will have some ideas for you as well.


But — couldn’t you just check a checkbox when you’re ready for the record to be sent through your automation? That’s the easiest way to do it.


Thanks, Scott. Good to know about that 7-15 minutes…that could work! Where do you see that information? I was referencing the same formula page that you were.


To answer your question for my specific use-case - I’m creating a form that can choose a pre-defined attachment image based on a single-select field. So the single-select field is something like “Photo 1”, “Photo 2”, “Photo 3”, etc and the image that posts to Facebook is based on the selection during the form.


Automations can’t accept IF/THEN statements (e.g. “If ‘Photo 1’ use Photo1_attachment field, if ‘Photo 2’ use Photo2_attachment field, etc”), so an automation has to handle that logic first and upload it to a singular “Social Media Image” field that is then referenced by the Facebook Post Automation.


So the user flow is: User selects “Photo 2” and submits the form > Automation takes Photo2_attachment field and uploads it as an attachment to “Social Media Image” > Facebook Automation posts using the “Social Media Image” attachment as the image.


Bigger picture, I’m working on a simple social scheduler that can accept pre-defined fields (like pre-defined images). It seems like its 90% there, but the fact you can’t delay an automation is making it difficult to roll out.


But bigger picture, outside of my specific need, there really should be a simple way to delay automations.


ScottWorld
Forum|alt.badge.img+20
  • Brainy
  • 8713 replies
  • September 18, 2020
Mike_Mauer wrote:

Thanks, Scott. Good to know about that 7-15 minutes…that could work! Where do you see that information? I was referencing the same formula page that you were.


To answer your question for my specific use-case - I’m creating a form that can choose a pre-defined attachment image based on a single-select field. So the single-select field is something like “Photo 1”, “Photo 2”, “Photo 3”, etc and the image that posts to Facebook is based on the selection during the form.


Automations can’t accept IF/THEN statements (e.g. “If ‘Photo 1’ use Photo1_attachment field, if ‘Photo 2’ use Photo2_attachment field, etc”), so an automation has to handle that logic first and upload it to a singular “Social Media Image” field that is then referenced by the Facebook Post Automation.


So the user flow is: User selects “Photo 2” and submits the form > Automation takes Photo2_attachment field and uploads it as an attachment to “Social Media Image” > Facebook Automation posts using the “Social Media Image” attachment as the image.


Bigger picture, I’m working on a simple social scheduler that can accept pre-defined fields (like pre-defined images). It seems like its 90% there, but the fact you can’t delay an automation is making it difficult to roll out.


But bigger picture, outside of my specific need, there really should be a simple way to delay automations.


@Mike_Mauer


Ah, the discovery about the 7-15 minute delay just came from personal testing that some of the people in this community had done on their own, and then I tested it out on my own as well.


You’re right that Automations can’t handle IF/THEN logic yet, but that is probably coming in the near future.


But this is what I would do: Your automation doesn’t really need to run on a schedule. It sounds like your first automation runs just fine, correct? Based on the selection that the user makes in the form, the proper photo is uploaded into your “Social Media Image” field, correct? This part works fine?


So your 2nd automation just needs to wait long enough until your “Social Media Image” has an image in it, correct? If so, then I would just change your trigger to “When a record matches conditions”, and have it trigger as soon as your social media image field is no longer empty.


Let me know if that works for you!


  • Inspiring
  • 14 replies
  • September 18, 2020
ScottWorld wrote:

@Mike_Mauer


Ah, the discovery about the 7-15 minute delay just came from personal testing that some of the people in this community had done on their own, and then I tested it out on my own as well.


You’re right that Automations can’t handle IF/THEN logic yet, but that is probably coming in the near future.


But this is what I would do: Your automation doesn’t really need to run on a schedule. It sounds like your first automation runs just fine, correct? Based on the selection that the user makes in the form, the proper photo is uploaded into your “Social Media Image” field, correct? This part works fine?


So your 2nd automation just needs to wait long enough until your “Social Media Image” has an image in it, correct? If so, then I would just change your trigger to “When a record matches conditions”, and have it trigger as soon as your social media image field is no longer empty.


Let me know if that works for you!


@ScottWorld


Thanks Scott, I appreciate it!


I tried exactly what you suggested but the problem is what I previously described - a placeholder image is uploaded immediately while the actual file uploads in the background, so it triggers the “Attachment field is not blank” filter before it’s done uploading.


I suspect the placeholder image is done as a UI thing so you know that a file is uploading, but the result is that you can’t actually write a rule that says “Run this action when the file is finished uploading”.


kuovonne
Forum|alt.badge.img+17
  • Brainy
  • 5987 replies
  • September 18, 2020
ScottWorld wrote:

@Mike_Mauer


Ah, the discovery about the 7-15 minute delay just came from personal testing that some of the people in this community had done on their own, and then I tested it out on my own as well.


You’re right that Automations can’t handle IF/THEN logic yet, but that is probably coming in the near future.


But this is what I would do: Your automation doesn’t really need to run on a schedule. It sounds like your first automation runs just fine, correct? Based on the selection that the user makes in the form, the proper photo is uploaded into your “Social Media Image” field, correct? This part works fine?


So your 2nd automation just needs to wait long enough until your “Social Media Image” has an image in it, correct? If so, then I would just change your trigger to “When a record matches conditions”, and have it trigger as soon as your social media image field is no longer empty.


Let me know if that works for you!



Uploading of attachments can be a bit tricky. As @Mike_Mauer mentioned, there is a delay between when an attachment field is no longer considered blank and when the image is actually uploaded. And in some cases, if Airtable cannot retrieve the attachment from the url, the image might not ever become fully attached.



setTimeout does work in a scripting app (even though the editor complains about it), but it needs to be called correctly. However, I wouldn’t use setTimeout in a Scripting action for an automation. Scripting actions must complete within 30 seconds.


Instead, I would go about this with a slightly different technique. I would create a new formula field that checks to make sure that there is an attachment and that the last updated time was a couple of minutes before NOW(). Then I would run the automation off of the when a record meets conditions on the formula field. The automation might not run until several minutes after the attachment is actually uploaded (due to the delays in when NOW is recalculated, but it will run automatically, and it won’t run unless the attachment is present.


IF(

  AND(

    {Attachment},

    DATETIME_DIFF(

      NOW(),

      LAST_MODIFIED_TIME(Attachment),

      'minutes'

    ) > 1

  ),

  "run automation"

) 


ScottWorld
Forum|alt.badge.img+20
  • Brainy
  • 8713 replies
  • September 18, 2020
kuovonne wrote:

Uploading of attachments can be a bit tricky. As @Mike_Mauer mentioned, there is a delay between when an attachment field is no longer considered blank and when the image is actually uploaded. And in some cases, if Airtable cannot retrieve the attachment from the url, the image might not ever become fully attached.



setTimeout does work in a scripting app (even though the editor complains about it), but it needs to be called correctly. However, I wouldn’t use setTimeout in a Scripting action for an automation. Scripting actions must complete within 30 seconds.


Instead, I would go about this with a slightly different technique. I would create a new formula field that checks to make sure that there is an attachment and that the last updated time was a couple of minutes before NOW(). Then I would run the automation off of the when a record meets conditions on the formula field. The automation might not run until several minutes after the attachment is actually uploaded (due to the delays in when NOW is recalculated, but it will run automatically, and it won’t run unless the attachment is present.


IF(

  AND(

    {Attachment},

    DATETIME_DIFF(

      NOW(),

      LAST_MODIFIED_TIME(Attachment),

      'minutes'

    ) > 1

  ),

  "run automation"

) 


Great solution, @kuovonne! :smiling_face_with_sunglasses: 🙌


  • Inspiring
  • 14 replies
  • September 19, 2020

@kuovonne


This is very clever, thank you! I’ll give it a shot tonight and report back.


kuovonne
Forum|alt.badge.img+17
  • Brainy
  • 5987 replies
  • September 19, 2020

I just put an explanation and working demo of this setup on my website.


ScottWorld
Forum|alt.badge.img+20
  • Brainy
  • 8713 replies
  • September 19, 2020

This is awesome, @kuovonne!!


  • Inspiring
  • 14 replies
  • September 20, 2020
kuovonne wrote:

I just put an explanation and working demo of this setup on my website.


Just tested it out and it works! Very clever solution, thank you.


I’m not 100% sure we can consider this completely resolved, but for anyone who is reading this in the future here is the current status:


You can not pause or delay automations by a specific amount of time in Airtable. What you can do, however, is use @kuovonne’s method, which will allow you do delay things in increments of 5-15 minutes (the range is dependant on how often Airtable refreshed your NOW() command).


I've been looking into ways to fix this problem for myself, and the best thing I came up with was to create 5 steps (check box fields). 

PDF gets generated upon form submission - "Cert In" gets checked when "PDF" not empty - "Step 1" gets checked when "Cert In" is checked- Same for "Step 2" ---> "Step 5". After "Step 5" box is checked AND "PDF" not empty AND "Cert In" is checked, then send "PDF" to user email and mark "Cert Sent" as checked.

Works every time. 


  • New Participant
  • 2 replies
  • January 31, 2023
kuovonne wrote:

Uploading of attachments can be a bit tricky. As @Mike_Mauer mentioned, there is a delay between when an attachment field is no longer considered blank and when the image is actually uploaded. And in some cases, if Airtable cannot retrieve the attachment from the url, the image might not ever become fully attached.



setTimeout does work in a scripting app (even though the editor complains about it), but it needs to be called correctly. However, I wouldn’t use setTimeout in a Scripting action for an automation. Scripting actions must complete within 30 seconds.


Instead, I would go about this with a slightly different technique. I would create a new formula field that checks to make sure that there is an attachment and that the last updated time was a couple of minutes before NOW(). Then I would run the automation off of the when a record meets conditions on the formula field. The automation might not run until several minutes after the attachment is actually uploaded (due to the delays in when NOW is recalculated, but it will run automatically, and it won’t run unless the attachment is present.


IF(

  AND(

    {Attachment},

    DATETIME_DIFF(

      NOW(),

      LAST_MODIFIED_TIME(Attachment),

      'minutes'

    ) > 1

  ),

  "run automation"

) 


Hi @kuovonne great solution. I have tried it and I think it is what I was looking for. The only thing is that the automation is working only when running test (I have this problem also with other implementations of this automation). Can you or anyone help?

So I have a grid with supply quantity and date of an order. Sometimes not the whole quantity is shipped, so I wanted an easy form (I'm using interfaces), where my colleagues write the shipped quantity. So, to sum up:

- if the shipped quantity is the same as the expected supply quantity, great, nothing happens and the record changes status to "shipped";

- If shipped quantity is different from zero and the difference with the expected quantity is non zero, the record changes to "shipped" status, the field of the expected shipment (it must be it, as it is the visible field in all the interfaces and statistics) should update and a new record in which the expected next shipment amount is the difference between what should have been shipped and what was really shipped.

I hope I explain myself, it's easier to see than to say. So airtable fails to do this operation. Before using the interfaces, my boss would go to the database and change the expected supply with the shipment quantity; an automation would run with no problem and a new record with the remaining amoun would be created.

At first, instead of using a delay system as the one above, I would just change the expected supply field via the form, but I had many Issues as the automation would run before I could finish typing the number, creating many discrepancies.

Thank you


  • New Participant
  • 2 replies
  • January 31, 2023
PsicoPulcino wrote:

Hi @kuovonne great solution. I have tried it and I think it is what I was looking for. The only thing is that the automation is working only when running test (I have this problem also with other implementations of this automation). Can you or anyone help?

So I have a grid with supply quantity and date of an order. Sometimes not the whole quantity is shipped, so I wanted an easy form (I'm using interfaces), where my colleagues write the shipped quantity. So, to sum up:

- if the shipped quantity is the same as the expected supply quantity, great, nothing happens and the record changes status to "shipped";

- If shipped quantity is different from zero and the difference with the expected quantity is non zero, the record changes to "shipped" status, the field of the expected shipment (it must be it, as it is the visible field in all the interfaces and statistics) should update and a new record in which the expected next shipment amount is the difference between what should have been shipped and what was really shipped.

I hope I explain myself, it's easier to see than to say. So airtable fails to do this operation. Before using the interfaces, my boss would go to the database and change the expected supply with the shipment quantity; an automation would run with no problem and a new record with the remaining amoun would be created.

At first, instead of using a delay system as the one above, I would just change the expected supply field via the form, but I had many Issues as the automation would run before I could finish typing the number, creating many discrepancies.

Thank you



SORRY, missing words

- If shipped quantity is different from zero and the difference with the expected quantity is non zero, the record changes to "shipped" status, the field of the expected shipment (it must be it, as it is the visible field in all the interfaces and statistics) should update and a new record should create in which the expected next shipment amount is the difference between what should have been shipped and what was really shipped.

 


  • Participating Frequently
  • 6 replies
  • January 6, 2024
buildsomething wrote:

I've been looking into ways to fix this problem for myself, and the best thing I came up with was to create 5 steps (check box fields). 

PDF gets generated upon form submission - "Cert In" gets checked when "PDF" not empty - "Step 1" gets checked when "Cert In" is checked- Same for "Step 2" ---> "Step 5". After "Step 5" box is checked AND "PDF" not empty AND "Cert In" is checked, then send "PDF" to user email and mark "Cert Sent" as checked.

Works every time. 


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
  • Participating Frequently
  • 5 replies
  • October 2, 2024

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


kuovonne
Forum|alt.badge.img+17
  • Brainy
  • 5987 replies
  • October 2, 2024

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
  • Participating Frequently
  • 5 replies
  • October 3, 2024

@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


kuovonne
Forum|alt.badge.img+17
  • Brainy
  • 5987 replies
  • October 3, 2024
magicalpotion wrote:

@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


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.


Reply