Best answer

Schedule a Meeting on First Working Day Of Next Month

  • 27 May 2021
  • 3 replies
  • 795 views

Userlevel 1

I’m trying to create a Zap which schedules a meeting on the first working day of the next month.

I found this guide which explains how to check whether a date is on a weekend and hoped I could adapt that solution but it only seems to help manage weekdays for the current week, not another week in the future. So I’m not sure whether lookup tables are the solution here.

Can anyone suggest a way that I can get the first day of the next month, check whether it’s a weekday and get the date of the following Monday if it isn’t?

icon

Best answer by SamB 23 August 2021, 16:36

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Userlevel 7
Badge +11

Just wanted to follow-up here to suggest an alternative no-code solution as well. :)

Troy’s suggestions are correct here but for anyone that may not comfortable with writing code or building a lookup table containing the details for all first of the months that fall on a weekend Google Sheets, you can use our Formatter and Paths apps to achieve this.

To get the first day of the next month we need two Formatter steps, one to add a month to the current date ({{zap_meta_human_now}}) using the expression +1 month. Then set the To Format to output just the month and year using a custom value of MM/YYYY:

43977aa10b1d8523eb49704ac0a32b26.png

A similar process is discussed here: 


Next, a second Formatter step is used to get the day of the 1st day of the next month. You’d do that by typing in “01/“ and selecting the next month and year value from the previous Formatter step:

b2b414930c58b842a01392e773b9059f.png

This would output the name of the day as Mon, Tues, Wed etc.

Then ideally you’d use a Paths action to set up two Paths (Add branching logic to Zaps with paths). One that checks whether the output of the previous Formatter step contains “Sat” and the other to check if it contains “Sun”. This would indicate whether the 1st of the month is on a weekend.


Finally, in the step that creates the meeting, you’d select the month and year output from the first Formatter step and type either “02/“ or “03/“ in front of it. That would give you the first Monday of the next month.

For example for the “Sunday” Path you’d type in “02/”. And for the “Saturday” Path, you’d type “03/” in front of it to get the first Monday’s date. For example:

e38428b0454d32dc86073fbb8c7793e2.png

It’s also possible to achieve using a Filter instead of Paths by having two duplicate Zaps each checking for either “Sat” or “Sun”. But this would use additional Tasks compared to the version that uses Paths.

Userlevel 7
Badge +14

@alexs 

OR you could create and maintain a lookup table in a GSheet or Airtable to serve a similar purpose.

 

Zap action steps

GSheets - Lookup Row

OR

Airtable - Find Row

Userlevel 7
Badge +14

Hi @alexs 

You may need to utilize some custom code in a Code step in order to determine this.

Code: https://zapier.com/apps/code/help

 

Logic

Logic would go something like this:

Check if 1st of the month is a weekday

If TRUE, then use

If False, then repeat for the 2nd of the month

… and so on for the first 7 days of the month