- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2017 01:46 PM
Hi all,
I'm building a scheduled job to fire an event, and am using the following script, however in the line in BOLD the script is giving me the error in the screen shot...it's not firing the event properly and my notification that is triggered off that event is not sending. Error in my script? thanks!
var sd = new GlideRecord('change_request');
sd.addQuery('state','-5');
sd.query();
while(sd.next()) {
if(gs.dateDiff(gs.nowDateTime(),sd.end_date.getDisplayValue(), true) < 0)
gs.eventQueue('change.notification', sd.number, sd); //something wrong here?
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2017 02:07 PM
Your second parameter needs to be a record. See this Wiki article for details:
3.1.1 Input Fields
Parameters:
- Name of the event being queued.
- A GlideRecord object, such as "current".
- An optional parameter, saved with the instance if specified.
- A second optional parameter, saved with the instance if specified.
- An event queue to add the event to.
So the following should work:
gs.eventQueue('change.notification', sd, sd.number);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2017 02:42 PM
excellent thanks Michael. And one more question...do notifications fire in the developer instance? I know that wouldn't actually send an email, but would notifications that should be sending show up in the System Logs > Email? Just to verify that my chain from scheduled job > event >notification is working.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2017 02:45 PM
You should be able to see them in the Outbox, if email hasn't been configured.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2017 02:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2017 02:50 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2017 02:55 PM
hum... It seems that your event hasn't been processed. Are you sure your events process is processing events in your instance, or that you schedule job was set to run the job at a later stage, and that time hasn't come ?