Forum

Thread tagged as: Runway, Forms

Form received date in email template

Is the received date for a form accessible by the email template? I'd like to record, via email, the date a form was submitted.

Chris George

Chris George 0 points

  • 2 years ago

Chris,

UPDATE: Try this in email template <perch:email id="responseCreated" />

This date is recorded as responseCreated in the database when the form is recorded. You could try adding a field in your email template with the ID responseCreated and see if the date is output in the email.

This my not be possible, as I am just throwing an idea your way... but the date is absolutely being stored, I am not sure it is available to you at time of sending the email. Of course you could likely add via a hidden field and pass the date into the template which would be available to the email template.

Thanks for the idea Robert. I've tried response, date, responseCreated, responseDate and none of them work. So perhaps it not available. Perhaps Drew can confirm this?

In the meantime, I'll do a hidden field. I was hoping to avoid that.

Thanks again.

Chris,

If I remember correctly, the flow of how form responses is processed recording to the database is the last step, therefore the responseCreated column is not available at time of sending the email... but I thought it was worth a try...

Robert

Ah that would make sense.

In the end I added the following code to my page, and this works just fine...

$("#form1_submit").on('click', function(e){
    // get the current date/time and set the submitDate field
    var today = new Date().toUTCString();
    $('#form1_submitDate').val(today);
});
Drew McLellan

Drew McLellan 2638 points
Perch Support

The email is sent in the same process as receiving the form submission, so the email timestamp is the same as the form received date.

Drew McLellan said:

The email is sent in the same process as receiving the form submission, so the email timestamp is the same as the form received date.

responseCreated timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,