Skip to main content

Hi,

here is the solution to this frequently asked question. Just replace the value in delay( ) to change the time of delay. The maximum delay you can give is 30 Sec per action or automation will fail. For adding more delay the work way around is to add two scripts actions one below the other (See Image).

function delay(ms) { var limit = new Date(); limit = limit.setMilliseconds(limit.getMilliseconds() + ms); while ((new Date()) < limit) { // do nothing ; } } delay(20000); //delay 20 second



Just be aware that if the purpose of the delay is to let field values update, such as waiting for an attachment to upload, you will still have the original field values unless you do something to get the updated values, such as a “find records” action to get the new field values. Otherwise you will still be working with the original old field values.


Just be aware that if the purpose of the delay is to let field values update, such as waiting for an attachment to upload, you will still have the original field values unless you do something to get the updated values, such as a “find records” action to get the new field values. Otherwise you will still be working with the original old field values.


Indeed! and in such cases, you can add one more search Action


Hi Sannit_Vartak, and thank you for cutting so many trees in the jungle of threads pertaining near or far to this subject !

Works fine, but this warning in red in the code editor on my side ennoys me ... Do you think it is reliable ? Did you had the same by your side ?

 


Hi Sannit_Vartak, and thank you for cutting so many trees in the jungle of threads pertaining near or far to this subject !

Works fine, but this warning in red in the code editor on my side ennoys me ... Do you think it is reliable ? Did you had the same by your side ?

 


Yes you can ignore the error 🙂 


Just be aware that if the purpose of the delay is to let field values update, such as waiting for an attachment to upload, you will still have the original field values unless you do something to get the updated values, such as a “find records” action to get the new field values. Otherwise you will still be working with the original old field values.


Any ideas on how to find that record again?  My trigger is "when a record enters view".  Then I run this delay script.  Then I want to find the same record that just entered the view and send an email populated with that record data.  

More specifically, a PM opens a Job# (primary field), and adds lots of data about the job in other fields.  But not every job# uses the same fields, so I have the record enter a new view (thru filters) as soon as the primary field is not empty.  I want to delay the automation 10 minutes to allow time for any other info to be manually entered by the PM before the email goes out.   But it looks like I need to find the record that just entered the view to be able to pull data from it for the email body.  I don't know how to find it again.

Maybe a new formula field "Created in the last 10 minutes" that the automation can search for?  but that's kind of sloppy, because what if the PM begins entering data into an existing blank record?  the automation will fail.


Any ideas on how to find that record again?  My trigger is "when a record enters view".  Then I run this delay script.  Then I want to find the same record that just entered the view and send an email populated with that record data.  

More specifically, a PM opens a Job# (primary field), and adds lots of data about the job in other fields.  But not every job# uses the same fields, so I have the record enter a new view (thru filters) as soon as the primary field is not empty.  I want to delay the automation 10 minutes to allow time for any other info to be manually entered by the PM before the email goes out.   But it looks like I need to find the record that just entered the view to be able to pull data from it for the email body.  I don't know how to find it again.

Maybe a new formula field "Created in the last 10 minutes" that the automation can search for?  but that's kind of sloppy, because what if the PM begins entering data into an existing blank record?  the automation will fail.


Hey @Aaron_Hess,

You probably figured this out since but since I was using this thread and saw that no one replied back, I just made the automation do an edit to my entry right after the script (check a box, for example). Then, I can get the info back from that 'edited' entry in the next step of my automation.
Hope this helps!


Hey @Aaron_Hess,

You probably figured this out since but since I was using this thread and saw that no one replied back, I just made the automation do an edit to my entry right after the script (check a box, for example). Then, I can get the info back from that 'edited' entry in the next step of my automation.
Hope this helps!


Hey !

Since that thread i came to understand my problem.

You can wait as long as you wish, but it stays hard to tell when all the fields of the record will be updated.

A robust way to do it, that i have adopted since that thread is to read the record again, nothing more !


Hey @Aaron_Hess,

You probably figured this out since but since I was using this thread and saw that no one replied back, I just made the automation do an edit to my entry right after the script (check a box, for example). Then, I can get the info back from that 'edited' entry in the next step of my automation.
Hope this helps!

Hey !

Since that thread i came to understand my problem.

You can wait as long as you wish, but it stays hard to tell when all the fields of the record will be updated.

A robust way to do it, that i have adopted since that thread is to read the record again, nothing more !

Hey! Just wondering how you got the automation to read the record again? I tried some sloppy options but none seem to work reliably enough. Any ideas on a custom script maybe?


Hey ​@mriich,

For using the “edited” version of the record you will want to follow Kuovonne’s instructions above. Basically have a Find Records action block to find the version (after it has been already updated).
Then, on whatever new action block you have after that you would map values from this found record (found through the Find Records) rather than mapping values from the original trigger!

Does this make sense? Otherwise please let me know and I’d be happy to show you around on a quick call.

Mike, Consultant @ Automatic Nation 
YouTube Channel