Skip to main content

Hi there, this is Erin Oz from the Zapier Support Team with a workflow idea to share. 

A common workflow I see is users wanting to add a delay step and run on the following weekday. Date/time fields in Zapier can use relative information (like “Friday at 7pm”), but they’re not able to interpret this type of input: 

p7YGk3Yewx95TFMxxC8QUK7LS7kMAd0e8QzQPWdNH81AFr85VZgaMbjTcfcleMPUOdyGlgjnc3h3Sw7HU7-dGpgvJ0CG_pMvTgL7vdWFCc71OsMlFJTdGulSJRZO0q4p73P5ycIX

(view larger)

Example

This user would like to add a Delay Until step that will delay their Zap actions until the next weekday. One way would be to use Paths that filter on specific outcomes, but that might get tedious, since they’ll have to build a separate Path for the same set of actions. 

Using a Formatter Step and a Lookup Table will give us the following weekday, which we can then pull into the Delay Until step!   

1. Create a Formatter step using the Date/Time Event and select “Format” from the Transform dropdown:

IBjrqTCA8kfiwDYO5Sib4DjuzZ_Hrr135O0fWOAkwDCfxYxoxmpM12qnBe0cN_j4-usQ4iiHOMwiUIPUYW0xKdGPE4Usf4ksooHQzngQRBflJcUptJMqwaTICLbxb-OZQpxv7w0r

(view larger)

Type {{zap_meta_human_now}} into the Input value. The {{zap_meta_human_now}} inserts the current date into the Input.

You should see this pill pop up after typing the value:

647lR2dxzx7q7RDhVvx9qroDpajEXIhwhrFnUHg4IT1Bw1l1EIpsLbhfdSRUrpQGcuhPUEh7D2vWbAp1w6cwPsVxM8M8FuIJdxMCNX4FIPqH2PAnj3tYXXFuAsfgT81usYcA2qDV

(view larger)

 

In the “To Format” field, you’ll want to type “ddd” as a custom format. This will output a three-letter abbreviation for the day of the week! 

 

a63bd4e884ae932346c0d33e45c9a579.gif
(view larger)

2. Next, create a Formatter by Zapier step, select "Utilities", and select "Lookup Table" as the Transform value.

Map the output of the previous Formatter step as the Lookup Key:

KC8y4bcssfIzOhCxtENGeISFCw06vTzG7tcgJqV6FMPCMQNt4dz_A_8lAurt3ImLEErL9eNfbQSeTlrGdHFDGZrDzoeWw6hjMLlhMZNLA5HoPmd5p0l7VaGDf_B1WtS4uwj6lmHe

(view larger)

 

In the Lookup Table, type the three-letter abbreviation for days of the week on the left hand side as the keys, and for the values type the following business day - for example, next to the key Mon, I've typed the value Tuesday. That way, when the Zap runs on a Monday, it will return the day "Tuesday" to add to your Delay Until step. 

For Friday and Saturday, I’ve added the value Monday, as Monday is the next weekday following those days. (I've also added a fallback value of Monday in case there is an issue when the Zap runs.)

When testing this step, you should see the following business day - in this case, since our Formatter step returned initially Tue, our Formatter step test returns Wednesday:

 

ed1a27962aefd2590bfab8b96f211574.png

(view larger)

 

3. Now we can map that output of the Formatter step into the Date/Time Delayed Until field of our Delay step with "at 8am" typed after the mapped data, like this:

 

df0fa931da96f57e3d9c402a89a6d432.png

(view larger)

This way, each time the Zap runs, the steps following the Delay Until step will be delayed until the following weekday. 

​Does this make sense? Please let me know if you have any questions or need additional clarity on any of these steps. :sunglasses:

 

Hi @erinoz - great post! Going through your instructions and stuck on this step:

“In the “To Format” field, you’ll want to type “ddd” as a custom format. This will output a three-letter abbreviation for the day of the week! “

Here’s what I’m seeing.

Looks like there’s no way to just display the day without the timestamp? Could you share what I’m entering wrong here? Thanks!

 


Hi @darynakulya!

You’re SUPER close :)

You’ll want to click on the part that’s highlighted in this image:

click custom then you can type “ddd”

Can you give that a shot to see if it helps you out?


@nicksimard

I would say that the interface makes this step not completely intuitive. You have to click “Custom” which then produces a dropdown menu. Logically, I would think my input needs to go into the new search box that appeared and be given the opportunity to just add whatever format I typed if it wasn’t one of the prescribed options.

But, that’s not how it works. You have to click back above the “Custom” tab back into the original text box to type “ddd” and then click away.

Perhaps a solution to this is adding another tab for “manual” inputs or when a user types a non-suggested option into the search box, give them the option to add it.

For example: i 🔍   ddd (add) ]

---

That might not have been their issue, but I did find that to be a hurdle at first wondering why it wouldn’t take my format.

@darynakulya

 

Edit:

@erinoz


Thanks for pointing that out @darynakulya and @desmoe  - I’ve added a gif that will hopefully help make entering the “ddd” piece more clear! 


@erinoz 

Thank you for this write up. It is great!

Question - Wouldn't we want the fallback value for the lookup table to be Monday instead of Mon as we need to pass the full weekday name to the delay step? 


 Excellent catch @mweiner - you’re correct! I will update the screenshot with the full “Monday” value instead of “Mon”. 

 

Question - Wouldn't we want the fallback value for the lookup table to be Monday instead of Mon as we need to pass the full weekday name to the delay step? 

 

 


Ah, I love this post! If you are looking for a more granular approach to when a delay should happen during business hours, I wrote up a post about this here:

 

 

Hope that helps 🙂


This is cool! I created something like this at my old company because people don’t like working on the weekend I guess ...Madness!


Great post! Quick question.. if there is not fallback value, and a match does not occur, will the zap continue? I want my zap to trigger only on Weekdays, not delay until the next business day. So if my lookup table only contains:

Sun - Monday

Sat - Monday

Will this still work or is there a step I’m missing? 


What im testing now. Using only two step I can set up hours, days of the week, holidays and timezone.

from datetime import datetime, timedelta, date, time

#Timezone configuration
my_timezone=-3

#business_hours configuration
business_hours = {
# monday = 0, tuesday = 1, ...
"weekdays": [0, 1, 2, 3, 4],
"from": time(hour=9),
"to": time(hour=17)
}

#holidays configuration (year, months, day)
#Exemples holidays = [date(2022, 12, 25), date(2022, 12, 24)]
holidays = []

def is_in_open_hours(dt):
return dt.weekday() in business_hours["weekdays"] \
and dt.date() not in holidays \
and business_hours["from"].hour <= dt.time().hour < business_hours["to"].hour

def get_next_open_datetime(dt):
while True:
dt = dt + timedelta(days=1)
if dt.weekday() in business_hours["weekdays"] and dt.date() not in holidays:
dt = datetime.combine(dt.date(), business_hours["from"])
return dt

def delay_time (dt):
if is_in_open_hours(dt):
return (dt)
else:
return get_next_open_datetime(dt)

dt_test = datetime.now()+timedelta(hours=my_timezone)
delay_time_var = str(delay_time (dt_test))
#dt_test = datetime(2022, 10, 7, 20)
#print(dt_test)
#dt_test = date.today()
#print(delay_time(dt_test))

return {
'delay_time_var': delay_time_var
}

 

 

 


hi @erinoz It seems you can input e.g. Wednesday at 8am into the delay until field.. Is it possible to get an overview of the type of inputs it will understand. 

I want to build a Weekdays after 5 pm but before 8 am and Weekends 24/7


I found this article and it helps:

https://help.clicksend.com/article/kpf9owj574-schedule-sms-during-business-hours-with-zapier


Hey folks, I’m so sorry we missed your replies here! 

 @MarioR: Quick question.. if there is not fallback value, and a match does not occur, will the zap continue? I want my zap to trigger only on Weekdays, not delay until the next business day. So if my lookup table only contains:

Sun - Monday

Sat - Monday

Will this still work or is there a step I’m missing? 

I expect you’ve already got this figured this out but in case anyone else comes across this and has the same use case, I’d suggest taking the approach outlined in Leo’s guide here instead: 

 

@Proteusbr

What im testing now. Using only two step I can set up hours, days of the week, holidays and timezone.

from datetime import datetime, timedelta, date, time

#Timezone configuration
my_timezone=-3

#business_hours configuration
business_hours = {
# monday = 0, tuesday = 1, ...
"weekdays": 0, 1, 2, 3, 4],
"from": time(hour=9),
"to": time(hour=17)
}

#holidays configuration (year, months, day)
#Exemples holidays = xdate(2022, 12, 25), date(2022, 12, 24)]
holidays = m]

def is_in_open_hours(dt):
return dt.weekday() in business_hours)"weekdays"] \
and dt.date() not in holidays \
and business_hours "from"].hour <= dt.time().hour < business_hours&"to"].hour

def get_next_open_datetime(dt):
while True:
dt = dt + timedelta(days=1)
if dt.weekday() in business_hours)"weekdays"] and dt.date() not in holidays:
dt = datetime.combine(dt.date(), business_hourse"from"])
return dt

def delay_time (dt):
if is_in_open_hours(dt):
return (dt)
else:
return get_next_open_datetime(dt)

dt_test = datetime.now()+timedelta(hours=my_timezone)
delay_time_var = str(delay_time (dt_test))
#dt_test = datetime(2022, 10, 7, 20)
#print(dt_test)
#dt_test = date.today()
#print(delay_time(dt_test))

return {
'delay_time_var': delay_time_var
}

 

 

Awesome work on that alternative approach! 🙌 Thanks for taking the time to share details of that your solution - that’s such an efficient way to handle it!

 

@KasperDupont: hi @erinoz It seems you can input e.g. Wednesday at 8am into the delay until field.. Is it possible to get an overview of the type of inputs it will understand. 

You can view the documentation around the accepted date formats here: Different field types in Zaps > Supported date/time formats
 

Thank you so much for sharing that ClickSend article here. I’m sure it will be super helpful to lots of folks here in the Community! 🤗