Script: Set Defaults

15612 7
Showing results for 
Search instead for 
Did you mean: 
10 - Mercury
10 - Mercury

Introducing Default Field Values via new Scripting Block

Brought to you by the team at BuiltOnAir & Openside/On2Air


Airtable’s Scripting block brings a new level of customization to your Airtable bases. The Scripting block will allow you to run scripts to enhance your bases and manage tedious tasks. You can do things such as create templates for records, prompt users, create custom reports, and much more. Once the script is added to your base, you can use it with the click of a button.

We are creating a library of scripts for you to use in your Airtable bases. We have many more examples on the way. These scripts will give you an even better understanding of the data in your base and eliminate repetitive data entry.


About This Script: Setting Default Values

In this tutorial, we will show you how to set a default value for any record or field in your base.

With this script, every time you create a record in your base table, it will automatically add the data you set as a default. You will not have to manually enter the information. It will also add the data to records already created if you need to add or change previous records.

Setting a default value for a field will save hours of data entry and ensure data consistency, especially useful for records shared among multiple users. You can use this script for your entire table or you can choose a view to filter only specific records.

First, we will show you how to add the script to your Airtable base for the initial set up. This will only have to be done one time. We’ve created an easy template for you to start.

Second, we will show you how to use the script to configure and set your default values.

To use this script, you do not need to know any code or programming. You must have ‘Owner’ or ‘Creator’ permissions to set up the Script Block since you will be adding a table. You can then allow ‘Editor’ users to use the block.

Example Base & Script

Install from the Universe this Block


How To Set Up the Scripting Block for Setting Defaults

1. Create a new table in your base and call it Defaults


If you would like the table to have a different name, you will need to change the name in the script. We will show you how to do this later.

2. Copy all records from our example base and paste into your base in the Defaults Table you created


This table is connected to the script to store all your defaults.

You now have fields with Name, Value, Type, Table, and Code. These correspond to fields in the first few lines of the script code we will add.

3. Click the Blocks button in the top right corner


4. Click Add a block and choose the Scripting block



5. Click Edit in the top right corner of the block to open up the script editor



6. Copy the script from our example base and paste it into your script editor in the top left box


You now have the Script added to your base!

Or, you can also retrieve the code here.

Note: If you would like to change the Defaults table name or the field names, you will need to also change the names in the script.


How to Add Default Values

Now, we will show you how to set default values for your fields. This is what you will need to do each time you need to add, change, or delete the default values.

1. Click Run


2. Click Configure Defaults


All the tables in your base will now display. The tables in my base are Simple Table and All Fields.


The Defaults table you created earlier will not show since you don’t need to create defaults for your Defaults table.

3. Select the table and view where you want the default values set

You will then be given the option to choose a specific view. If you want to set defaults for only a specific view, choose the corresponding view. If you want to set defaults for all records in the table, choose No View.

Choosing a specific view is useful for updating default values for only a certain set of records. You may not want to update all your table records with defaults so choosing a view will allow you to specify which records need defaults. We recommend choosing a specific view if your table has a large amount of data.


Once you’ve chosen a View, all the fields from the table will be displayed.

Note: Currently, the cursor drops down to the last field. Scroll up to the top to start with the first field.


4. Set your defaults

Each line will tell you the Field Name and also the Field Type. You can also see the current default value if you have already configured one.

To add a default:

Type your default value in the box and press Next. You can also hit Enter to save the current line.


If you do not want a default value:

Leave the box blank.

If you need to clear out a previously configured default value:

Press the spacebar and click Next.

Once you add all your default values, click Done.

5. Click Set Defaults then choose the table where you added Defaults


It will now add your default values to the fields you set.

In this example, I set a default for the Notes field. The block will also tell you how many were updated.


Defaults By Field Type

To ensure each field displays your default data, review each of these field types to input your data with correct formatting. We have covered a majority of the fields. However, not every field type can have a default value set.

Single line text Text Data c8fcddc2c3274ea58e57579ded61ab7cb4008eb9.png
Long Text Text Data af2e2ed7510d42f35fa1200bfffbd28bee786f0d.png
Collaborator Add the Collaborator’s email address 8ac0be7fe4ede2a35bbcb76a5b555804fbad6873.png
Attachment This must be a URL to a publicly accessible file or image 2b7de202a2c615c355f5348d949f02c4feb803e0.png
Link to Table In order to set defaults for linked records to other tables, you will need the Record ID from the record in the table where you want to link.

To obtain the Record ID:
Add a Formula field in the table you want to link. Type in RECORD_ID() then click Save. You will now have a Record ID for each record in the table.
27ce2010d0f5baf87e14a95de0f1fbc44b5fc7ae.pngRecord ID:
Single Link Record ID Copy and paste the Record ID into the default value field 5d85441f8380d03bf952a848bf888dfbbde39c3e.png
Multiple Linked Records Record IDs Copy and paste the Record IDs into the default value field and add a comma between records b2ca86ecbe1fab15cb0b18ed7047bdd06e7067cc.png
Single Select Copy and paste the data from your Single Select field. These must be configured in your base prior to setting a default. You cannot add new single select options through the default value script. 52f0f7fc59bda8ea14e3c6a0d5c2bf6c7c5933de.png
Multiple Select Copy and paste the data from your Multiple Select field. You can add more than one default from your Multiple Select field by adding a comma between multiple select options. These must be configured in your base prior to setting a default. You cannot add new multiple select options through the default value script. 9f386c654695b8d60d73680527c4e5e95730053b.png
Date Format the date as MM/DD/YYYY. You can also add a Current timestamp by adding the word ‘now’ without the quotes. ab4ead7a840d844ce8168629f9fdfbfb3b839618.png
Phone Number Standard numerals 21dfa130e94b946e380b3a980f9f8bf2603938c5.png
Email Standard email format 9af88444716588b07d4de105dfbf9f4c98da57e0.png
URL Standard URL format 4d9a93940548cfc1809c2bf18d18101149877a02.png
Number Standard numerals d1eecfefee5132066489d912c8e939c421d648cc.png
Currency Standard numerals
Ex: 89 = $89.00 or your set currency
Percent Standard numerals in hundredths value
EX: Type .98 to get 98% or
.10 = 10%
Rating A numeral from 1 to 5
Ex: 3 = :star: :star: :star:
Rich Text Currently Not Supported By Scripts Block… Coming Soon…

You can now set defaults for fields in your base. All you need to do is click Configure Defaults when you need to change or update them.

If you have any trouble, join our Slack community and we will do our best to help you.

We are adding more scripts all the time so join our community to get the latest.

Stay Updated


BuiltOnAir is the ultimate resource for all things Airtable.

Utilizing the new scripting block, we can now address several product suggestions:

7 Replies 7
5 - Automation Enthusiast
5 - Automation Enthusiast

What should I do? I simply copied the full base and run. But I get an error:

TypeError: input.buttons is not a function
at start on line 211
at main on line 367


Did you get the script from the Airtable universe? This thread about breaking changes explains why you are getting that error.

You can find a fixed version of the script on the Built on Air website.

10 - Mercury
10 - Mercury

Hi @Leonardo_Felician - thanks for bring that up. I re-published the base with updated scripts. You can re-copy and it should work. Or also like @kuovonne mentioned you can copy the script from BuiltOnAir.

5 - Automation Enthusiast
5 - Automation Enthusiast

Sorry, your idea is very useful indeed, but it’s too difficult to get it working, very fragile.

This is my second attempt: what did I wrong?

ERROR: UserInputStartTime and some lines following, but after 10 mìnutes I’m trying to upload, copy, link the error message and I always get the anser “not possible in a post” I don’t know how to send you

5 - Automation Enthusiast
5 - Automation Enthusiast

Running, Configuring Defaults defaults, and then hitting Done will result into this. No changes has been made:

Error: userInputStartTime
at Object.setIsAwaitingInput (h ttps://
at _callee2$ (h ttps://
at tryCatch (h ttps://
at Generator.invoke [as _invoke] (h ttps://
at Generator.prototype. [as next] (h ttps://
at asyncGeneratorStep (h ttps://
at _next (h ttps://

ps. sorry I had to add a space between “h” and “ttps” so that it won’t read as a link. According to Airtable new users can only post 3 links

10 - Mercury
10 - Mercury

hmm, it appears some recent changes to the scripting block api are causing this error. i’ll have to revisit it when I get some time.

4 - Data Explorer
4 - Data Explorer

It is showing the same error when I’m hitting done while configuring the default values.

N: userInputStartTime
at start on line 352
at async main on line 367

Did anyone got the solution for this?