Can I conditionally send emails based on the time the form was sent?

  • WSIguy
    Asked on April 20, 2017 at 10:59 AM
    2) We would like to tailor the auto-reply email message based on the time a user sends the form (i.e. outside of business hours).
    Is it possible to place a condition on the email auto-reply based on the actual (server) time the form was sent?
  • Support_Management Jotform Support
    Replied on April 20, 2017 at 11:22 AM

    This should be achievable 😊 Here are all the things you need:

    1. A Time Field added to your form, setup like this:

    TIME FORMAT = 24 HOUR

    DEFAULT = CURRENT

    READ ONLY = ON

    Can I conditionally send emails based on the time the form was sent? Image 1 Screenshot 50

    2. Have 2 separate Autoresponders - one for WITHIN BUSINESS HOURS and another for OUTSIDE BUSINESS HOURS.

    Can I conditionally send emails based on the time the form was sent? Image 2 Screenshot 61

    Related guide: Creating-a-Form-Autoresponder

    3. Then finally, the conditions needed. In my example, business hours is 8AM (8:00) to 5PM (17:00).

    Can I conditionally send emails based on the time the form was sent? Image 3 Screenshot 72

    The logic is that:

    IF Time is BEFORE 8:00 AND AFTER 17:00 THEN send the OUTSIDE BUSINESS HOURS email template

    IF Time is AFTER 8:00 AND BEFORE 17:00 THEN send the WITHIN BUSINESS HOURS email template

    Can I conditionally send emails based on the time the form was sent? Image 4 Screenshot 83

    Complete guide: How-to-Send-Email-Based-on-User-s-Answer 

  • WSIguy
    Replied on April 21, 2017 at 3:53 AM

    Thank you for that!
    However, please note one error in that logic.

    Since the 24 hour (720 minute) day spans 2 calendar dates, while, to us, 22:00 is after 17:00 and before 8:00 (tomorrow), within the 1 day, it is both after 8:00 AND after 17:00.
    So the day needs to be broken into 3 time slots: before hours, business hours, and after hours.
    The day starts at 0:00 and finishes at 24:00.

    So the conditional for Business hours uses AND.
    The conditional for outside hours uses ANY.

    Also for anyone using this, note that the business hours should use:
    After 7:59
    Before 17:01

    Otherwise mails at exactly 8:00 and 17:00 fill fail.

    Thanks again!

  • Ashwin JotForm Support
    Replied on April 21, 2017 at 5:07 AM

    Hello WSIguy,

    Thank you for pointing it out. I did check you form and found that you have already added this condition and changed the time accordingly. Please check the screenshot below:

    Can I conditionally send emails based on the time the form was sent? Image 1 Screenshot 20

     

    Do get back to us if the conditions works as expected or you need some other changes.

    We will wait for your response.

    Thank you!

  • WSIguy
    Replied on April 21, 2017 at 5:14 AM

    Correct. I added the appropriate conditions to the form.
    I have tested it on both sides of the threshold, and it seems to be working fine.

    Thanks for the help.

    Bruce

  • Ashwin JotForm Support
    Replied on April 21, 2017 at 5:17 AM

    Hello Bruce,

    I am glad to know that you form is working as expected.

    Do get back to us if you have any questions.

    Thank you!