Create A Block


Blocks is a collection of all your Scripts with enhanced capabilities. With Blocks, a single small piece of code is generated to add to the Scripting Block in your Airtable base. This will create a Menu of all your scripts in a single block, allowing you to click a button and run each script when needed.

The menu in your base will display a button for each script.



In this example, Search & Replace and Say Hello are individual scripts added to a Block.

You can edit each script within the On2Air: Scripts dashboard where it will automatically be updated across all of your bases.

In this article:

Create a New Block
Block Script Tab
Adding the Block Code to Your Airtable Base
View and Reorder Scripts
Rename Your Block
Block Settings
Version History

Before creating Blocks, you must create Scripts in the Scripts menu

Learn more about creating Scripts to add to your Blocks.
Learn more about creating Snippets to add to your Scripts.

Create a New Block

Click Blocks on the left-side menu

In the Scripts tab, click Add Script to Block

Select the Script you want to add and click Add New Block Script

Repeat this step as many times as needed. You can add as many Scripts to a Block as needed



Rename your Block by clicking in the New Block title field

Toggle the switch below the title field from Disabled to Enabled to enable your Block

Select the Export tab to view the generated code

Click Copy to Clipboard to copy the code

You can now add the code to the Scripting Block in your Airtable base OR you can add additional Javascript code to the Block Script tab. The Block Script tab allows you to add code to the top of every script in your Block



Block Script Tab

The Block Script tab is another key element to Blocks. You can add code in the Block Script text field used for every script across your entire base. The code will be added to the top of every script in your Block.



In this example, we want to run both of our scripts for the table "States" and the field "State"

Adding the Block Code to Your Airtable Base

If you haven't used the Scripting Block in Airtable, learn how to add code to the Scripting Block.

Select the Export tab to view the generated code

Click Copy to Clipboard to copy the code

Install the Scripting Block in your Airtable base

Paste the generated code into the text field

Click the blue Run button

Click each script button when needed to run the script

In this example, we can see our two scripts, "Search & Replace" and "Say Hello", now listed as a menu. You can click on each one to run the respective script.



View and Reorder Scripts

You can reorder scripts in your block to display in a certain order in Airtable. 

You can view each Script by selecting the View Script button.



Rename Your Block

You can rename your Block by clicking New Block (or any name already declared) in the title field.

When you click out of the field, your name will be automatically saved.



Block Settings

Code

A unique ID is generated for each Block. Click Refresh at any time to generate a new ID.

Button Support

If you are using your Block in a Button field, you can enable Button Support. This will create the code necessary to use your Script as a Button.

Enable Button Support

Enter Variable Name
You can enter a variable name to reference the record used as your Button

Enter the Button Title

Bypass Menu for Single Script

Use this if you only have one Script saved in your block. This will bypass the menu of Script buttons displayed when there is more than one Script. This can be useful if you want to run a Script with a Button field.

Delete Block

If you no longer want a Block, click Delete Block

Verify deletion by clicking Yes, I want to delete this block
WARNING: Deleting a script cannot be undone.



Version History

You can save each version of your Block.

To save a Block

Under the Block Script tab, click New Version

Use the automatically filled Version ID or add your own

Add a Description

Click Create New Version

Block Version History

Please note, this will not automatically save each version of your Block. You must manually create a new version.

To view Version History

Click the Version History tab

Click the Version you would to view
Was this article helpful?
Cancel
Thank you!