Help with error "getEventTarget() called with invalid record reference"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2018 03:11 AM
Hi,
I've created a new 'Scheduled Job' that runs every hour with the following code:
var myQuery = 'inc_company!=d6417bf56c5b3100a9474cdec0731892^inc_priorityIN1,2^inc_stateNOT IN6,7^taskslatable_sla.condition_class=d8e775510a0a2c9429616e9a8b7b6f15';
var myInc = new GlideRecord('incident_sla');
myInc.addEncodedQuery(myQuery);
myInc.query();
while (myInc.next()) {
gs.eventQueue('bt.ssoc.mim.alert', myInc, '', '');
I've set the 'run as' to the System Administrator user.
Unfortunately it is throwing an error - e.g.
getEventTarget() called with invalid record reference: incident_sla.722cb3c2373747005a5c5aa5 for event: bt.ssoc.mim.alert, could have been deleted
for each record that it finds in the above query.
I did notice that, because I'm querying the 'incident_sla' table, that there are 2 sys_ids relating to the selected records.
We operate a domain separated instance but the System Administrator user has access to all domains.
Can anyone see a problem with the event queue statement above?
Many thanks in advance,
Keiron.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2018 04:10 AM
Sorry, I've just realised that the task_sla table won't contain all of the fields I need to pass on to the emails.
I may need to get the relevant incident record and pass that object in the EventQueue - I will give that a try.
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2018 04:20 AM
YES
nice catch.
let me know if you need any further help..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2018 07:28 AM
FYI Harshvardhan...
I ended up simply querying the incident table - I did need to pass the SLA definition name across to the email notification but I could derive this value from the priority of the incident.
Everything is working a expected - many thanks for taking the time to respond,
regards,
Keiron.