getEventTarget() called with invalid table name:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2012 11:20 AM
I have created a business rule which checks periodically if a change request is still open 24 hours after its end_date. If so it fires an event that sends out an email notification.
The problem I am having is when the business rule runs and fires the event, I get a warning that states the following:
getEventTarget() called with invalid table name: f82f5a390a0a3c9f00de405e6e670cce for event: change.overdue
Business Rule Script
NotifyChangeOverdue();
function NotifyChangeOverdue() {
var now = gs.nowDateTime();
var gr = new GlideRecord('change_request');
gr.query();
while (gr.next()){
gs.log("Overdue Notification sent for Change # " + gr.number);
gs.log("Overdue Notification sent for Change # Type:" + gr.type + " -- Change Owner:" + gr.assigned_to.name);
gs.eventQueue("change.overdue", gr.sys_id, gs.getUserID(), gs.getUserName());
}
}
The event queue then shows that it has run the script that it has an invalid table.
The event is registered with the change_request table. Also the business rule is configured to run against the change_request table. I am not seeing what else I need to do in creating my custom event.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2012 02:12 PM
It probably really should be
gs.eventQueue("change.overdue", gr, gs.getUserID(), gs.getUserName());
Passing gr in the parameter is actually passing the GlideRecord object (as the Wiki states). I'm thinking you might get into trouble using "current", because what really "is" current?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2012 05:34 AM
Yep, that was it, Jim. Pass the object "gr" fixed it completely and allowed us to use the fields in the email notification to customize our notification.
Almost feel like this was a big duh moment for us.