- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2018 11:44 AM
I'm needing to setup a reminder email for users when the survey expires the next day. I have read through the community and setup what I think I need but it's still not working.
I have a Event setup called task.send_survey_reminder
I then have an email notification setup to send when the event is fired. I have surveys that are set to expire tomorrow but the email is not going out. I checked the event log and I don't see it. What am I missing?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2018 12:34 PM
You need to query for any surveys that have not yet been completed. To do that, use GlideRecord. Something like this:
var survey = new GlideRecord('asmt_assessment_instance');
survey.addEncodedQuery('state=ready^due_dateONTomorrow@javascript:gs.beginningOfTomorrow()@javascript:gs.endOfTomorrow()^userISNOTEMPTY');
survey.setLimit(1); //limiting the query to just one record
survey.query();
while (survey.next()) {
gs.eventQueue('task.send_survey_reminder', survey);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2018 12:00 PM
You need something to actually create the event at the right time. This is typically a scheduled job that runs daily or hourly. It would query the assessment table for records basically matching what you have in the notification's conditions, then create an event for each record that is found.
Here's how you would actually trigger the event in a GlideRecord loop.
gs.eventQueue('task.send_survey_reminder',[gliderecord]);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2018 12:18 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2018 12:34 PM
You need to query for any surveys that have not yet been completed. To do that, use GlideRecord. Something like this:
var survey = new GlideRecord('asmt_assessment_instance');
survey.addEncodedQuery('state=ready^due_dateONTomorrow@javascript:gs.beginningOfTomorrow()@javascript:gs.endOfTomorrow()^userISNOTEMPTY');
survey.setLimit(1); //limiting the query to just one record
survey.query();
while (survey.next()) {
gs.eventQueue('task.send_survey_reminder', survey);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2018 12:24 PM
I have the scheduled job setup as above. I have the registered event setup and the email notification. I run the job manually and it doesn't send the email. Am I missing anything else?