- 23 Aug 2023
- 4 Minutes to read
Scripting extension overview
- Updated on 23 Aug 2023
- 4 Minutes to read
The scripting extension can streamline your workflows when you want to modify field information, add multiple records at once, filter with complex criteria, and more. With the introduction of script templates, any user - even without technical knowledge - will be able to leverage the power of the Scripting Extension by installing pre-built scripts from our extensions marketplace created by Airtable and members of Airtable’s growing community.
|Plan availability||All paid plans|
|Platform(s)||Web/Browser, Mac app, and Windows app|
Extension - Extensions are modular components that add visuals or functionality to a base, and were shown in the base's dashboard. Users can create custom extensions, or they can use extensions created by Airtable or other open-source extensions.
Adding a script from the extensions marketplace
You can now install pre-built scripts from our extensions marketplace. Start by visiting the scripts section of the marketplace and browsing through the available script templates.
When you find one you'd like to install, click the "Install" button. You'll then be given an option for which base you'd like to install the script on.
Add your own custom script
To get started with developing your own custom script, view our developer documentation here.
Getting started with the scripting extension
Once you have added the scripting extension to a dashboard in your base, the extension will open up in edit mode with three panes. If you are not able to add the scripting extension, your organization may have restricted the use of the scripting extension for your account.
- Any user can press the Run button in a scripting extension, however, the scripting extension respects the permission level of the user running the script.
- For example, if a certain line of code were to "update a record" or "create a record," then the user running the script would need to have corresponding permission levels, in this case, creator-level permissions, in order to successfully run the script. If the user does not have those permissions, then the scripting extension will throw an error code.
Running a script
To run a script, click the "Run" button in the right-hand results pane. If you need to stop the executing script at any time, you can click the red "Stop" button in the upper right. Once the script is complete, you have the option to run it again using the "Run" button.
Using script settings, you can enable an interactive UI to make your script more user-friendly and easily customizable. Rather than hard-coding table names or field names, you can add an interactive UI to configure settings for the script.
To get started with script settings, add a call to input.config() at the beginning of your script, and follow the in-app documentation (under API -> Script Settings) in the scripting extension code editor. You can also access the documentation and see more examples here.
As you update your code in
input.config(), the UI in the right-hand pane will update accordingly. Settings can be defined for tables, fields, views, text, numbers, and select options. After the settings have been configured in the interactive UI, the object returned from
input.config() will contain the actual models for these items that can be referenced later in your code. When running a script with script settings enabled, the settings panel needs to be fully populated before the "Run" button is enabled.
After settings are configured from the UI, the values chosen will persist between runs and are shared between all collaborators. To re-configure the script settings, simply click the settings icon:
Scripting extension code editor
The scripting extension includes a robust, built-in code editor. You can switch to the edit mode by clicking the "Edit" button in the upper left of the extension. When you are done writing code, you can exit by clicking the "Finish editing" button. In edit mode, the extension will expand to fit the current window (note the image below shows a very small window to best show the switching to edit mode).
The code editor is built on Monaco, an open-source component managed by Microsoft. If you have used Visual Studio Code in the past, some of the functionality of the scripting extension code editor will be very familiar.
- Shortcuts (see below)
- Syntax highlighting
- Collapse and expand nested code
Select all code
Undo last action
Shift Cmd v
Redo last action
As of now, the scripting extension executes when you click the run button. If you're interested in writing a script that will run on a certain trigger, check out the Run a script action.
Minimize the in-app docs by clicking the down arrow.
Yes, the scripting extension (note, this is ONLY available in the scripting extension, not in Automations nor via the Airtable Web API) includes a method
.updateOptionsAsync() that can be used to update the names and colors of select options. You can learn more about the method here and how to do it for specific field types (like single select) here.