Help

Triggering CreateFieldAsync script by time interval

Topic Labels: Automations Extensions
Solved
Jump to Solution
334 5
cancel
Showing results for 
Search instead for 
Did you mean: 
Paul_Thompson
6 - Interface Innovator
6 - Interface Innovator

I'm not normally a scripter, but just spent two weeks trying to put this little routine together and make it work. The script calculates the date one year in the future and uses it to rename a new column in the format MMM'YY.  After loads of trial and twice as much error, I actually got in to work!:

Script create & name row.png
Naturally I was really pleased with myself! Now just to apply a trigger. I want it to run on the first of each month. My first idea was to paste it into an automation. But I soon discovered that scripts run from the automation cannot create fields.

Screenshot 2024-02-26 at 00.05.46.png

How frustrating! Why not? Can anybody think of a workaround? Is there a command I can put in the script editor to make it trigger on a regular interval?
Any ideas or workarounds gratefully received.

1 Solution

Accepted Solutions
TheTimeSavingCo
17 - Neptune
17 - Neptune

As a workaround you could try calling the API via the automation instead? 

Here's the relevant documentation: https://airtable.com/developers/web/api/create-field

The access token with the ability to modify the table schema would be visible to everyone who has access to the base though, and if that's a problem you could use an integration tool like Zapier, IFTT, Make etc to run the script instead

See Solution in Thread

5 Replies 5
Dan_Montoya
Community Manager
Community Manager

Hi Paul -- I don't have a comment on what you have asked.  I'm curious about your use case for this?  

TheTimeSavingCo
17 - Neptune
17 - Neptune

As a workaround you could try calling the API via the automation instead? 

Here's the relevant documentation: https://airtable.com/developers/web/api/create-field

The access token with the ability to modify the table schema would be visible to everyone who has access to the base though, and if that's a problem you could use an integration tool like Zapier, IFTT, Make etc to run the script instead

Actually, it works.
But learning to use API is a much harder task than just scripting.

Alexey_Gusev_0-1708916117325.png

 

Hi Dan. We are a small not for profit organisation who's members pay a monthly subscription. The volunteers who run it are unpaid and we are grateful for what they do, so don't want to push things. The table concerned is only used by our treasurer, who is happy to fill in the fields but can never remember how to create more fields and I get that he doesn't really want to get involved with what he sees as the back end. He always messages me to log in and create some more date fields rather than do it himself, so I do a year at a time, duplicating and renaming them. For purposes of my own satisfaction and learning I thought I would try to automate the creation of a new column on the first of each month. My columns for subscription payments look like this:
| Jan'24 | Feb'24 | Mar'24 | Jun'24 | etc.

So each column is a month and each record is a member, synced with our membership database (which I also wrote). The concept is for the treasurer to have a complete year ahead in view at any time (Some members like to pay a year in advance).  Eventually I would like to incorporate a routine to automatically hide complete months from the view (columns with no unfilled cells) but right now, that doesn't seem possible as I can't find a way of hiding cells from a view by using script. 
Hopefully that explains the case use and the background behind it. It's not absolutely necessary as it's easy enough to do manually, but in my senior years (there were no computers in school when I was there) I am curious as to how to use them and write a script! It's far more difficult than I imagined. Now to learn about APIs (Whatever an Application Programming Interface Does). All I know is I used one to integrate with Jotform but had to change to something else! Thanks for your interest.

Thanks very much @TheTimeSavingCo. Out of sheer determination, stubbornness and curiosity, I'm going to try to learn about APIs and see if I can get one working. All I know about them is that I used to use one to integrate with Jotform but had to change to something else!