Many moons ago (well, more like a year ago) we published Two Easy Ways to Enforce Your Business Hours, which explains how to hide form fields during certain hours and days, as well as how to limit field selections based on the time and the day of the week. In the same spirit as the original post, we’re going to talk about how to enforce your business hours through email notifications and confirmations!
Design your workflow
With the ability to create multiple email notifications, you can route different emails to different people depending on your own specified rules. And, to take your workflow one step further, you can even send emails depending on the time and date that your form is submitted. For example, if your business only operates from Monday through Friday between 8:00 AM and 4:30 PM, you may want to email your customers a different confirmation message if they submit a form outside of business hours. To do this:
Open up your form builder and select Submission Settings. Then, either open an existing confirmation email, or add a new one:
In your confirmation settings, set the To address as an Email field on your form, and write the email message:
Next, select Send When Submitted - When and open the Advanced Editor. Here, you can enter the criteria that will determine when the email should be sent. For this example, we’ll use the following expression:
Entry.DateSubmitted.DayOfWeek = "Saturday" or Entry.DateSubmitted.DayOfWeek = "Sunday" or (Entry.DateSubmitted.Hour < 13 or Entry.DateSubmitted.Hour > 21) or (Entry.DateSubmitted.Hour = 21 and Entry.DateSubmitted.Minute > 30)
This expression represents any time outside of our business hours. Let’s break it down:
Entry.DateSubmitted.DayOfWeek = "Saturday" or Entry.DateSubmitted.DayOfWeek = "Sunday"
Because our business is only open from Monday through Friday, we won’t be available at all on Saturday or Sunday.
(Entry.DateSubmitted.Hour < 13 or Entry.DateSubmitted.Hour > 21) or (Entry.DateSubmitted.Hour = 21 and Entry.DateSubmitted.Minute > 30)
Our hours of operation are between 8:00 AM and 4:30 PM (that translates to 13 and 21:30 in UTC/GMT for my particular time zone). So, if the form is submitted either before 8:00 AM or after 4:30PM on any day from Monday through Friday, this confirmation will get sent.
Make sure to save your changes, and then test out your confirmations! Feel free to adjust the cut-off times in your expression so that you can test at any time of day.
You can apply this same basic process to a number of different scenarios; for example, you could also set your email notifications to alert different staff members depending on the time and the day.
Need any help creating conditional email notifications? Feel free to get in touch with our support team, or just leave a comment below!
Nadia is the Marketing Coordinator for Cognito Forms. In her spare time, Nadia enjoys listening to French house, drinking iced coffee, and talking about herself in third person.