Help

Can I call a script within another script?

Topic Labels: Scripting extentions
4997 5
cancel
Showing results for 
Search instead for 
Did you mean: 
David_Deborin
4 - Data Explorer
4 - Data Explorer

I’m a developer and plan on writing A LOT of different scripts.

Let’s say I create a script that sums the values of a column. I plan on using this script (function) in multiple scripts. Is there a way I can essentially call this script in separate scripts instead of having to copy and paste code all the time?

In other words, can I create global functions? Can I call a script in another script?

The same concept applies to global variables. My script will use the name of one of my columns. But if I change the column name, my script won’t work. I have to manually edit the script and change the column name. Global variables, or at least global to the table (doesn’t have to be the entire base), would enable the script to update automatically.

5 Replies 5
openside
10 - Mercury
10 - Mercury

Check out On2Air: Scripts which was built to solve this problem

Thank you for the link. I’m already paying a lot of money for Airtable Pro. However, paying at least $30/month extra for this is overkill.

Yawnxyz
5 - Automation Enthusiast
5 - Automation Enthusiast

You can use automations. For example, one script runs and sets a Dropdown to “Run Script C”, and an automation sees that change, detects “Run Script C” and runs that script. This doesn’t really scale all that well, of course… Would be really cool if we could get and call scripts, like scripts[‘Script Name’].call(some data) — that would be incredible

L_L
4 - Data Explorer
4 - Data Explorer

Maybe you can call from your script an airtable webhook connected to another script.

Can confirm that this works. Here’s what you need and the order in which I’d recommend building it:

  • one fetch request in base A to:

    • trigger a webhook automation in base B
  • one webhook automation in base B to:

    • save the request from base A (optional)
    • process it
    • construct a payload from the processed data
    • trigger a webhook in base A with the payload
  • one webhook automation in Base A to:

    • save the response from base B

Or, just keep repeating the second pattern and have the data rolling through more bases.