Help

Setting an Automation to only trigger during working hours

Topic Labels: Automations
3762 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Thomas_Mackay
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi Everyone,

I’m currently trying to set up an automation that only triggers during working hours, and ‘banks’ any non-triggered actions until the next working day. I.e. it only trigger between 9am and 5pm, and anything that would normally trigger it at 6pm is held until 9am the next working day.

I think I have a working solution, but would be interested to hear if anyone can think of anything better/simpler?

The context is a quality assurance process where an assessor completes an Airtable form, and when the form is submitted the assessee automatically receives an email with the results. Currently I have an email automation set up to just trigger when a new record is created (from the form).

My idea for how to limit the automation to working hours is:

  1. Create a new formula field (called “hour”) that returns HOUR(NOW())
  2. Create a new text field called “results sent?”
  3. Create a view called “automation” that is filtered to only include records where the Hour is between 9 and 16, AND records where “results sent?” includes ‘yes’
  4. Create an automation that:
  • Triggers when records enter the “automation view”
  • Sends assessee the results of their assessment
  • Updates the “results sent?” field of the record to ‘yes’

I’m pretty sure this would work, although I haven’t tested it yet. Downsides are that everything would go out of sync by an hour during daylight savings time. It’s also more complicated/obtuse than a straightforward automation, and I’m conscious of not wanting to build things where only I know how they work.

Any ideas on better solutions?

Thanks so much!
Tom

1 Reply 1

I just answered another user’s question that’s in a very similar vein.

In your situation, you could use this formula:

SET_TIMEZONE(NOW(), "America/Los_Angeles") > DATEADD(
    WORKDAY(CREATED_TIME(), 1),
    MAX(MIN(HOUR(SET_TIMEZONE(CREATED_TIME(), "America/Los_Angeles")), 9), 9)
    - HOUR(SET_TIMEZONE(CREATED_TIME(), "America/Los_Angeles")),
    "hours"
)

(change the timezone references as appropriate for your region)

That will calculate a time within the 9 o’clock hour on the next workday based on the created time of the record, and compare that against NOW(). When NOW() passes that calculated time, the formula will output a 1; otherwise it will output a 0. Set your automation to fire when any record outputs a 1 from that formula field, which will only happen once per record.