Trigger email based on value of Date/Time field in Form Submission assets


(Jamie Smith) #1

I'm looking to set up some sort of cron job to send an email based on the value of a Date/Time field in Form Submission assets associated with a Custom Form.

 

When a Form Submission asset is created, the Date/Time field will be set to a date in the future (likely using the JS API), at which time an email will be sent to the user.

 

Is there a way in Matrix to do this? The only thing I can think of is running a JS API script nightly to run through all Form Submissions to check the aforementioned date field, and, based on that, amend an arbitrary metadata field on the asset that would cause a Trigger to send out an email.

 

Seem slightly hacky, and I wondered whether there was a nicer to way to do it within Matrix?

 

Any thoughts welcome.


(Tim Davison) #2

Are you sending a separate email for each Form Submission once the specified date has been reached?  If so, you can use a metadata time trigger.  Event is Metadata Time, set the metadata time condition to the date in your metadata field, and the action to send an email.  

 

Note, however, that this will send an email every 15mins (or however long the interval your system's cron jobs are), so to overcome that you need to add another metadata field, something like 'Email Sent?' with a yes|no value.  Add a condition to the trigger so that it only runs if metadata Email Sent = no, and add an action after the send email action to set the metadata Email Sent = yes.  We use this approach very successfully with notifying authors of 6 month review cycles on pages.

 

If you are trying to get a conglomerate or list of form submissions that have reached that date in one email, however, unfortunately I have no way to do that either.  


(Jamie Smith) #3

Are you sending a separate email for each Form Submission once the specified date has been reached?  If so, you can use a metadata time trigger.  Event is Metadata Time, set the metadata time condition to the date in your metadata field, and the action to send an email.

 

Many thanks, Tim. Much appreciated. I'll go ahead and do that.