gs.eventQueue not kicking off Notification

kemmy1
Tera Guru

My scheduled Job is kicking this off every 30 minutes.  I see the process logs in the event logs (no errors) but my notification is not kicking off.  It's getting quite frustrating:

var br = new GlideRecord('x_g_dh5_brs_bed_space_request');
br.addEncodedQuery('status=originating aor review');
br.query();
while (br.next()) {
  if (br.sys_created_on == br.sys_updated_on) {
  gs.eventQueue('x_g_dh5_brs.brs.aor.notification', bedRequests, bedRequests.getUniqueValue(), 'aeadd02f1bc91850f0d743f1f54bcbe3'); /     //parm   2 is the sys_user sys_id of my account
  }

}

Here is my notification (I made it super simple)

kemmy1_0-1724692390572.pngkemmy1_1-1724692408567.png

 

kemmy1_2-1724692413532.png

 

8 REPLIES 8

Sandeep Rajput
Tera Patron
Tera Patron

@kemmy1 Please update the script as follows and see if it works.

 

var br = new GlideRecord('x_g_dh5_brs_bed_space_request');
br.addEncodedQuery('status=originating aor review');
br.query();
while (br.next()) {
  if (br.sys_created_on == br.sys_updated_on) {
  gs.eventQueue('x_g_dh5_brs.brs.aor.notification', br, br.getUniqueValue(), 'aeadd02f1bc91850f0d743f1f54bcbe3'); /     //parm   2 is the sys_user sys_id of my account
  }

}

 

Hope this helps.

That was a typo on my part.  The Event log gets created with the correct information

 

kemmy1_0-1724701265352.png

 But still no notifications kick off.

Sheldon  Swift
ServiceNow Employee
ServiceNow Employee

Hi @kemmy1 - In addition to resolving the naming inconsistency as @Sandeep Rajput has suggested...assuming you're comparing sys_created_on to sys_updated_on to determine if the record is new, you can also check if sys_mod_count is 0.

 

Seeing that you're running this job every 30 minutes, are you updating the record to ensure a notification isn't triggered for the same record? 

My events are kicking off (see above reply to Sandeep) and each event has a different sys_id of the record I want to create a notification for.  It's such a head scratcher.