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

  • Profile Image
    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?
  • Profile Image
    Jim_R
    Answered 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

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

    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).

    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

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

  • Profile Image
    WSIguy
    Answered on April 21, 2017 at 03: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!

  • Profile Image
    ashwin_d
    Answered on April 21, 2017 at 05: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:

     

    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!

  • Profile Image
    WSIguy
    Answered on April 21, 2017 at 05: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

  • Profile Image
    ashwin_d
    Answered on April 21, 2017 at 05: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!