Skip to main content
Solved

Creating several time slots ⌚

  • November 10, 2022
  • 2 replies
  • 81 views

Soly
Forum|alt.badge.img+15
  • Brainy
  • 44 replies

Hi!

I would like to write a script that automatically creates time slots one week in advance.
These time slots are every Tuesday and Wednesday from 9am to 2pm (6 time slots/day).
For now, I type them manually but there is certainly a better way… Let me know what you think

:slightly_smiling_face:

Best answer by Karlstens

Hey @Soly

Here's a script I wrote for you with this mornings coffee, for use with the Scripting Extension.

It demonstrates how to create a "records" object of 3 appointments, that will then stamp into your table. There's a bit to learn with how to use Date Objects within JavaScript - they will take some time to get used to - and my example might not be the most efficient way of filling Date and Time fields (although it works as I'd hoped).

Simply run the script to create 3 records.

This could further be placed into an Automation, and executed on a set period to create records each evening, or once a week, whatever/whenever you need really.

2 replies

Karlstens
Forum|alt.badge.img+24
  • Brainy
  • 602 replies
  • Answer
  • December 4, 2022

Hey @Soly

Here's a script I wrote for you with this mornings coffee, for use with the Scripting Extension.

It demonstrates how to create a "records" object of 3 appointments, that will then stamp into your table. There's a bit to learn with how to use Date Objects within JavaScript - they will take some time to get used to - and my example might not be the most efficient way of filling Date and Time fields (although it works as I'd hoped).

Simply run the script to create 3 records.

This could further be placed into an Automation, and executed on a set period to create records each evening, or once a week, whatever/whenever you need really.


Soly
Forum|alt.badge.img+15
  • Author
  • Brainy
  • 44 replies
  • December 5, 2022

Hey @Soly

Here's a script I wrote for you with this mornings coffee, for use with the Scripting Extension.

It demonstrates how to create a "records" object of 3 appointments, that will then stamp into your table. There's a bit to learn with how to use Date Objects within JavaScript - they will take some time to get used to - and my example might not be the most efficient way of filling Date and Time fields (although it works as I'd hoped).

Simply run the script to create 3 records.

This could further be placed into an Automation, and executed on a set period to create records each evening, or once a week, whatever/whenever you need really.


Hey @Karlstens ,

That's a wonderful gift. It works as expected! 🙂

✅You're right, I have just enrolled in a course to learn JavaScript, so I can write my own scripts soon.

That's inspiring that you're able to write them on the spot like this.☕

For now, I can tweak your script to add more time slots or extend them, following the pattern you provided.👍

Thank you so much!💐