0

I am migrating sql server database into REDCap. I am new to REDCap and I am still investigating the features of REDCap. I am building a survey form that will collect all the data into REDCap. Once the data is there in the REDCap, I want to send emails based on the date in the future. For example, if there are fields in the instrument as below

Email Expiry Date
test@gmail.com 12/12/2021

I want to send automated email to that email address(test@gmail.com) on that date date (12/12/2021). Basically, it has to look at the data and send out reminders to the email address on the expiry date.

I looked at alerts and notifications. I can write the conditional logic to send the reminder upon data entry. But, here in my case, the data is already stored.

I looked at the scheduling module. Scheduling module is generating events on the calendar but not sending emails automatically.

Is there a way I can achieve this?

wibeasley
  • 5,000
  • 3
  • 34
  • 62
Raja
  • 429
  • 4
  • 16
  • 1
    Welcome to Stack Overflow. Please take the [tour] to learn how Stack Overflow works and read [ask] on how to improve the quality of your question. Then check the [help/on-topic] to see what questions you can ask. Please see: [Why is “Is it possible to…” a poorly worded question?](https://softwareengineering.meta.stackexchange.com/q/7273) (don't just change your question to "How"). – Progman Feb 12 '21 at 17:21

1 Answers1

1

Which version of REDCap is your institution on? Since version 9.9.1 you can have an alert send either before or after a date field in your project. So the alert can be configured to be triggered by data import, and the time to send would be, say, 5 days before the [expiry_date].

Here is the changelog entry:

Improvement: A new send-time option has been added when setting up Automated Survey Invitations and Alerts & Notifications. When defining when the ASI/Alert should be sent, the option “Send after a lapse of time” has a new setting added so that, if desired, the user may set the time lapse relative to the value of a date or datetime field in the project. In previous versions, the time lapse setting could only be set relative to the time in which the ASI/Alert was triggered. That is still an option, but now users may also opt to send the ASI/Alert a certain amount of time either before or after the date/time of a specific field. This new setting will allow users to have greater control with regard to setting when ASIs/Alerts will be sent without getting too complicated in their setup, such as having to use complex logic (with datediff, etc.).

As the changelog says, another method is to use datediff logic in the trigger, which you will need to use if you are not on v9.9.1 or later (you should also encourage your institution to upgrade since there are important security patches since then). When an alert has a datediff function in its logic, REDCap will check it every four hours (unless the frequency has been changed by your administrators). This means you can send the alert 5 days before the expiry date with this logic:

(existing logic) and datediff("today", [expiry_date], "d", true) = -5

The true parameter here returns the signed value, so that if the first date is later than the second, it will return a negative value. false returns an absolute number.

This will be true on the exact day when [expiry_date] is 5 days in the future.

Jangari
  • 690
  • 4
  • 12