Child table not triggering notifications that are no the parent table

david_pinheiro
Giga Contributor

I have a notification on the Configuration item table that will trigger on a new record. When I create a new record on a child table it doesn't fire the notification. If I change the table on the notification to the child table the notification will fire. any ideas why the child table isn't firing the notification? Are notification not inherited?

1 ACCEPTED SOLUTION

geoffcox
Giga Guru

This bites me every time, but it is easy enough to cope with.



I assume you are queuing an event action: if you are passing a child table as current to the notification, then you are correct, the notification will not be triggered (not inherited). So before you fire the event, open the parent record and pass its reference to the event. This also applies the other direction. If the notification is on a child table, it will not fire for events queued on the parent table.



Note: This does mean that the notification will not have access to fields that are only on the child table. If you need   them in the notification, you may have to promote them to the cmdb_ci table.



So, for example, instead of:


gs.eventQueue("some.event",current,gs.getUserID(),gs.getUserName());


You would use:


var cmdb_ci = new GlideRecord('cmdb_ci');


if (cmdb_ci.get(current.sys_id)) {


      gs.eventQueue("some.event",cmdb_ci,gs.getUserID(),gs.getUserName());


}


View solution in original post

4 REPLIES 4

geoffcox
Giga Guru

This bites me every time, but it is easy enough to cope with.



I assume you are queuing an event action: if you are passing a child table as current to the notification, then you are correct, the notification will not be triggered (not inherited). So before you fire the event, open the parent record and pass its reference to the event. This also applies the other direction. If the notification is on a child table, it will not fire for events queued on the parent table.



Note: This does mean that the notification will not have access to fields that are only on the child table. If you need   them in the notification, you may have to promote them to the cmdb_ci table.



So, for example, instead of:


gs.eventQueue("some.event",current,gs.getUserID(),gs.getUserName());


You would use:


var cmdb_ci = new GlideRecord('cmdb_ci');


if (cmdb_ci.get(current.sys_id)) {


      gs.eventQueue("some.event",cmdb_ci,gs.getUserID(),gs.getUserName());


}


I'm not queuing an event I am just using the notification form and checking send on insert and update. Is the only way around this is to use the event queue?


Or, you could make a copy of the notification for the child table.


I ended up making the even queue instead. thanks