- 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 03:13 PM
Does the event gets processed?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2017 03:29 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2017 03:41 PM
Have you register the event change.notification ?
Please have a look at the following link:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2017 03:42 PM
In your personal instance, you can navigate to System Properties->Email Properties and activate Email Sending and in 'Send All email to test email address', you can mention your email accounts.
Also go to Administration->Email Accounts and check if you have the POP3 and SMTP email accounts.
And check if you have events.process 1 in your scheduled jobs.
If not you have to create these email accounts and export the schedulers from a different instance and import it to your personal instance.
I didnt have these, so I had to create them
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2017 04:00 PM
Hi Sanjiv,
I actually went ahead and developed this in our company DEV instance and it's working perfectly...thanks!
Patrick