Next, create an automation for when a record is created:


Add a script action:

Paste in the script in the following pastebin: //If you have any questions about this, reach me at devon[-at-]playfrey.tech// - Pastebin.com

Next, we need to configure this step a bit:
- Change “configTable” to be EXACTLY what the name of your table is (In this case, “Projects”)

Do the same with the other two:

Next, we need to add the following input from the record that was created:

It’s vital that it’s the “Trim” of the record ID

For Date, just the date field is fine:

Next, click finish in the top right and turn on the automation:

Finally, go ahead and create a record:

You’ll notice that the Number field auto increments, however if I convert the date field to a regular date field, then set up a form view and submit a project for next year ( the only way you should use this if you’re not using a created time field 😞

You’ll see that the counter reset back to one.
You can even backdate records and they’ll keep count in that specific year. FEDIT: Don't backdate records, things get weird, and I don't know if I'll ever get around to fixing it]
Hopefully this was helpful. I don’t check here often, but if you want some help with this script don’t be afraid to shoot me using the email in my pastebin.
Thanks for sharing! It is very helpful!
Welcome to the community, @Devon_Godfrey! :grinning_face_with_big_eyes: Thanks for chiming in on this topic! I’m in the middle of creating my own script to append to the thread of mine that you linked above, but I’ve been swamped by other stuff and haven’t been able to wrap it up yet. I’ll hold off on checking out your solution until I finish mine. However, I will edit the category for this thread, as this belongs in the “Show and Tell” group instead of “Ask the community”.
Welcome to the community, @Devon_Godfrey! :grinning_face_with_big_eyes: Thanks for chiming in on this topic! I’m in the middle of creating my own script to append to the thread of mine that you linked above, but I’ve been swamped by other stuff and haven’t been able to wrap it up yet. I’ll hold off on checking out your solution until I finish mine. However, I will edit the category for this thread, as this belongs in the “Show and Tell” group instead of “Ask the community”.
Appreciate you Justin!
I’ve been getting emails asking about resetting daily and monthly, I just updated the pastebin so there’s now a option in the config variables to reset it daily and monthly.
Appreciate you Justin!
I’ve been getting emails asking about resetting daily and monthly, I just updated the pastebin so there’s now a option in the config variables to reset it daily and monthly.
Thanks for this Devon. Wondering how I can edit this to change based on Fiscal year, rather than calendar year?
Thank you for this! I keep getting an error that says:
“Error: Field “fldlEQVsveTqEliYH” cannot accept the provided value.
at main on line 92”
Any ideas here?
Thank you for this! I keep getting an error that says:
“Error: Field “fldlEQVsveTqEliYH” cannot accept the provided value.
at main on line 92”
Any ideas here?
@Brian_Podnos We’ll need more details about how you’re attempting to implement the script, including the types of fields in your table.
@Devon_Godfrey please help this is not working with latest Airtable version
it creates 001 all the time for all the records.
please help
@Devon_Godfrey please help this is not working with latest Airtable version
it creates 001 all the time for all the records.
please help
Sorry for the late reply, I just tested it and it still works good.
I've got it running in this base here: https://airtable.com/apps92mEiuq586J1d/shrBCb9CAL96uvnGv
Link to the form. Feel free to drop some records in here and see how the base responds in the previous link: https://airtable.com/apps92mEiuq586J1d/shrkuPkl67k8AYhdn
Attached are screenshots of the automation.
The key things are to make sure:
- You edit the configuration variables at the top of the script to match EXACTLY the name of the fields ( configTable, configDateField, configYearAutonumberField )
- You add in input variables that pull in the field data from the created record. The names must match EXACTLY what I have in the screenshot. (createdRecord, recordDate)
As long as you get these correct, everything else should fall into place.
Edit: Link to the script in pastebin: https://pastebin.com/HiMtb1Yv
Edit: Added an "instructions" table to the example base, that includes screenshots and how to set everything up
OMG, thanks @Devon_Godfrey ! This is excatly what I was looking for! 😉
I solved my problem in 5 minutes but before your post I was banging my head just thinking how will I manage to do that for like a month 🙂 I thought that this will be very stressfull task so I didn't even google it until 2024 came along 🙂
Happy 2024!
Hi @Devon_Godfrey!
My script was working great until today. When I create new row, it starts with 1 again (ever if I have 19 rows in 2024). so this should be number 20 and not 1), and also for every new row, it always brings me back 1 .
Do you know why is this happening?
I check automation (your script) and some error was found.
Error: Could not find a record with ID "rec78zGIBjPdUyQwv".
Could not find a record with ID
at main on line 98
I created a new one but now I'm getting 1 for every new row.

Thanks for your help.
Spela
Hi @Devon_Godfrey!
My script was working great until today. When I create new row, it starts with 1 again (ever if I have 19 rows in 2024). so this should be number 20 and not 1), and also for every new row, it always brings me back 1 .
Do you know why is this happening?
I check automation (your script) and some error was found.
Error: Could not find a record with ID "rec78zGIBjPdUyQwv".
Could not find a record with ID
at main on line 98
I created a new one but now I'm getting 1 for every new row.

Thanks for your help.
Spela
If you look back in my instructions for creating this:
They MUST be a date and single line text field, respectively! ( I would highly suggest that we make the date field a created time field )
A lot of it has to do with this exact issue.
So what's going on is that the script sorts the records by date, and uses that to determine the next number. Far from perfect, but if you deviate from that you get the odd behavior like you're seeing.
The simple solution is to make sure the date field is a created time field (automatically generated), so that there's always a "progression" and you never end up with a later record being earlier than a previous record. If you need to document a specific date for each record, I'd recommend simply having a separate, editable date field for that.
Having an editable date field is fine for testing purposes, but I wouldn't encourage it for a live environment.
So to fix your issue:
1. Have 1 field that is the plain text, per the instructions
2. Have another field that is a created time, per the instructions and associate with the script
3. Have another, separate customizable date field that you can use for your purposes.
If you look back in my instructions for creating this:
They MUST be a date and single line text field, respectively! ( I would highly suggest that we make the date field a created time field )
A lot of it has to do with this exact issue.
So what's going on is that the script sorts the records by date, and uses that to determine the next number. Far from perfect, but if you deviate from that you get the odd behavior like you're seeing.
The simple solution is to make sure the date field is a created time field (automatically generated), so that there's always a "progression" and you never end up with a later record being earlier than a previous record. If you need to document a specific date for each record, I'd recommend simply having a separate, editable date field for that.
Having an editable date field is fine for testing purposes, but I wouldn't encourage it for a live environment.
So to fix your issue:
1. Have 1 field that is the plain text, per the instructions
2. Have another field that is a created time, per the instructions and associate with the script
3. Have another, separate customizable date field that you can use for your purposes.
I had date field as a created time field from the beginning. Actually it was a formula field: DATETIME_FORMAT(CREATED_TIME(), 'D. M. YYYY')
Now I created a new field as "created time" and it's working again.
Thank you for your help!
I had date field as a created time field from the beginning. Actually it was a formula field: DATETIME_FORMAT(CREATED_TIME(), 'D. M. YYYY')
Now I created a new field as "created time" and it's working again.
Thank you for your help!
I had this working perfectly but yesterday the autonumber stopped being created. There are some posts about AT problems with Automations at the moment, anyone else experiencing this?
I had this working perfectly but yesterday the autonumber stopped being created. There are some posts about AT problems with Automations at the moment, anyone else experiencing this?
The first place I'd look is the run history. If there are any errors there in regards to the script post them here.
The first place I'd look is the run history. If there are any errors there in regards to the script post them here.
Hi @Devon_Godfrey as if by magic or your presence in this thread the script is now working without any changes by me, perhaps AT had a wobble that has been fixed?
Hi there!
I want to share a handy method for automating periodic resets of auto-number fields without needing to dive into scripting. Here’s a quick guide:
### **Set Up Your Tables**
- **Main Table**: Make sure you have a "Created On" date field.
- **Time Periods Table**: Fill it with entries for each time period (year, month, or day) depending on how frequently you need the reset.
### **Create Key Formula Fields**
In your Main Table:
- **Year**: `YEAR(Created On)`
- **Month-Year**: `YEAR(Created On) & "-" & MONTH(Created On)` for monthly tracking.
Adjust these formulas based on whether you're resetting yearly, monthly, or daily.
### **Automate the Linking Process**
Set up an automation:
- **Trigger**: When a new record is created.
- **Actions**:
- **Find Records** in "Time Periods" that match your period formula.
- **Update Record** to link the new record to the identified time period.
### **Testing Your Setup**
Create some test records to make sure they automatically connect to the correct periods in the "Time Periods" table.
**Why This Rocks:**
- **Zero coding required**: Just set up and go!
- **Efficient and scalable**: Handles large datasets smoothly.
- **User-friendly**: Easy for anyone to implement.
Hope this helps streamline your auto-numbering needs! Let me know if you have questions or need further clarification. Happy to help!
Hi there!
I want to share a handy method for automating periodic resets of auto-number fields without needing to dive into scripting. Here’s a quick guide:
### **Set Up Your Tables**
- **Main Table**: Make sure you have a "Created On" date field.
- **Time Periods Table**: Fill it with entries for each time period (year, month, or day) depending on how frequently you need the reset.
### **Create Key Formula Fields**
In your Main Table:
- **Year**: `YEAR(Created On)`
- **Month-Year**: `YEAR(Created On) & "-" & MONTH(Created On)` for monthly tracking.
Adjust these formulas based on whether you're resetting yearly, monthly, or daily.
### **Automate the Linking Process**
Set up an automation:
- **Trigger**: When a new record is created.
- **Actions**:
- **Find Records** in "Time Periods" that match your period formula.
- **Update Record** to link the new record to the identified time period.
### **Testing Your Setup**
Create some test records to make sure they automatically connect to the correct periods in the "Time Periods" table.
**Why This Rocks:**
- **Zero coding required**: Just set up and go!
- **Efficient and scalable**: Handles large datasets smoothly.
- **User-friendly**: Easy for anyone to implement.
Hope this helps streamline your auto-numbering needs! Let me know if you have questions or need further clarification. Happy to help!
Can you create a test base with this and share it?
Hi there!
I want to share a handy method for automating periodic resets of auto-number fields without needing to dive into scripting. Here’s a quick guide:
### **Set Up Your Tables**
- **Main Table**: Make sure you have a "Created On" date field.
- **Time Periods Table**: Fill it with entries for each time period (year, month, or day) depending on how frequently you need the reset.
### **Create Key Formula Fields**
In your Main Table:
- **Year**: `YEAR(Created On)`
- **Month-Year**: `YEAR(Created On) & "-" & MONTH(Created On)` for monthly tracking.
Adjust these formulas based on whether you're resetting yearly, monthly, or daily.
### **Automate the Linking Process**
Set up an automation:
- **Trigger**: When a new record is created.
- **Actions**:
- **Find Records** in "Time Periods" that match your period formula.
- **Update Record** to link the new record to the identified time period.
### **Testing Your Setup**
Create some test records to make sure they automatically connect to the correct periods in the "Time Periods" table.
**Why This Rocks:**
- **Zero coding required**: Just set up and go!
- **Efficient and scalable**: Handles large datasets smoothly.
- **User-friendly**: Easy for anyone to implement.
Hope this helps streamline your auto-numbering needs! Let me know if you have questions or need further clarification. Happy to help!
Hi Atusr,
My organization has disabled scripts, so your solution would be a great help to me. Can you go into a little more detail on your process? If I'm reading your post correctly, I would want a 2nd table with a column that contains incremental numbers: 2024, 2025, 2026, etc.
Then what do I enter for Find Records?
- **Find Records** in "Time Periods" that match your period formula.
- **Update Record** to link the new record to the identified time period.
As a novice AirTable user this isn't clear to me.
Look forward to any help you might provide.
Hi Atusr,
My organization has disabled scripts, so your solution would be a great help to me. Can you go into a little more detail on your process? If I'm reading your post correctly, I would want a 2nd table with a column that contains incremental numbers: 2024, 2025, 2026, etc.
Then what do I enter for Find Records?
- **Find Records** in "Time Periods" that match your period formula.
- **Update Record** to link the new record to the identified time period.
As a novice AirTable user this isn't clear to me.
Look forward to any help you might provide.
If you only need incremental numbers, then the auto-increment field should work nicely by itself. This solution is for if you need that counter to reset on a regular basis.
You can read about auto-numbers here: https://support.airtable.com/docs/number-based-fields-in-airtable
If you need it to start at a different number, set up a formula field and add the auto increment number to it (For instance, {auto-number-field} + 2000)
If you only need incremental numbers, then the auto-increment field should work nicely by itself. This solution is for if you need that counter to reset on a regular basis.
You can read about auto-numbers here: https://support.airtable.com/docs/number-based-fields-in-airtable
If you need it to start at a different number, set up a formula field and add the auto increment number to it (For instance, {auto-number-field} + 2000)
Thanks for your reply Devon.
I'm actually looking for exactly what was described in the original post in this thread. To have tickets numbered 2024_001 and on, then in January switch to 2025_001. For now I'm using the autonumber field until I'm granted access to scripting or Atusr gives me some additional details for his suggestion.