Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Mar 10, 2020 07:27 AM
Hi all! Starting to dig in to the scripting block a bit more… is there a way to force the script to run automatically?
Wrote a script to watch a table and make sure everything is linked to the same record on a junction table… but this is rendered useless if I have to train people to hit the button every time they login. :slightly_smiling_face:
Mar 10, 2020 08:44 AM
Okay, so you have created a useless script. This is one of the pitfalls lacking good requirements planning.
As you now know, there is no way to encourage scripts to run on a specified interval. Nor is there an event-model in Airtable that might recognize when a script should fire. I believe both of these are likely features in Airtable’s future, but until then your options are limited.
Write the script block in a way that causes it to always run looking for the linking conditions to process. This involves a while(true) loop that never evaluates to false. There are two key issues with this - (a) Airtable might not like it; it’s using server resources day and night, and (b) it requires your browser to be live and uninterrupted to run the block 24/7.
Move the script to a proper API-driven approach that fires every ten minutes.
Mar 10, 2020 09:15 AM
Welp, thanks for the advice. I have this being done automatically already with Zapier, but was hoping to be able to save some steps here and there by moving it to the scripting block. :woman_facepalming:
Mar 10, 2020 09:19 AM
Yep - makes sense and even more so in this post.
If you are using Zapier to transform or ingest data AND the business requirement calls for lights-out processing (automatically invoked), a script block is not likely to compete for that business because there are presently no apparent ways to invoke a script block via the API or via a direct web service call into the script block.
Mar 24, 2021 08:36 PM
@AlliAlosa Could you share the script you wrote originally? Now that automation triggers exist for scripts. I might find use in your orginal script.
Thanks,
Tom