- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2014 07:24 AM
I am trying to set up an email notification ONLY IF a change task is 7 days past due date! The email should only be sent to the person who has been assigned the change task.
Please help!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2014 08:50 AM
I don't think you're actually looping through the records you found in your example, so gr is referencing a set of records. Try this:
var gr = new GlideRecord('change_task');
gr.addQuery('due_date', '<=', gs.nowDateTime());
gr.addQuery('active', true); //you probably want to add this so you only send reminders on open tasks
gr.query();
while (gr.next()) {
gs.eventQueue("change_task.duedate_reminder", gr, gs.getUserID(), gs.userName());
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2014 12:49 PM
By the way this is the error log message
"getEventTarget() called with invalid record reference.change_task. for event: change_task.duedate_reminder, could have been deleted"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2014 08:50 AM
I don't think you're actually looping through the records you found in your example, so gr is referencing a set of records. Try this:
var gr = new GlideRecord('change_task');
gr.addQuery('due_date', '<=', gs.nowDateTime());
gr.addQuery('active', true); //you probably want to add this so you only send reminders on open tasks
gr.query();
while (gr.next()) {
gs.eventQueue("change_task.duedate_reminder", gr, gs.getUserID(), gs.userName());
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2014 11:13 AM
Thank You ...You were right!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2015 09:10 AM
Brad,
Quick question about this. My assumption is that the gs.eventQueue refers to the table email template and not the email notification, correct?
I have not been able to get the scheduled script to run, see below, maybe I am missing something:
var gr = new GlideRecord('cmdb_ci_spkg');
gr.addQuery('u_term_note_date', '<=', gs.nowDateTime()); // compare notice date and current date
gr.query();
while (gr.next()) {
gs.eventQueue("cmdb_ci_spkg.license_reminder"); // set email via license_reminder template
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2015 09:22 AM
Hi Wade,
gs.eventQueue() fires an event. You have to also have registered the event and set up an email notification to respond to the event. In your case, you also need to pass a second argument there, which would typically be your gr object like this:
gs.eventQueue("cmdb_ci_spkg.license_reminder", gr, gs.getUserID());
I always pass a userid as well out of habit.