The CreatorCon Call for Content is officially open! Get started here.

Notification not being created when the event is fired

Alex Sastre
Tera Guru

I have a Scheduled Script Execution with this script:

var grCase = new GlideRecord("sn_customerservice_case");
grCase.addQuery("state", "18");
grCase.addQuery("u_on_hold_reason", "1");
grCase.addQuery("sys_updated_on", "<=", gs.daysAgo(4));
grCase.query();
while (grCase.next()) {
    //Sent email if las updated 
    var gdt = new GlideDateTime(grCase.getValue("sys_updated_on"));
    var gdt4 = new GlideDateTime(gs.daysAgo(4));
  
    if (gdt.getDate().toString() == gdt4.getDate().toString()) {
        gs.eventQueue("sn_customerservice.case.information.request.reminder", grCase);
    }
}

I also have an email notification created to send whenever the event is fired with no other conditions:

AlexSastreBra_0-1695044366592.png

The idea is that a notification is sent when a case has not been updated for 4 days and its status is On hold and on hold reason is Awaiting info.

My problem is that the email notification is not being triggered and I have checked all these things:

1-. The email notification and the Scheduled Script are active.

2-. There isn't other conditions in the notification (image attached).

3-. I have check the sys_email logs and the notification isn't there.

4-. I check the script and I have a case that meet the conditions (And I know that the event is fired).

 

Any ideas of what can I do to get that notification been sent?

 

Thank you.

 

1 ACCEPTED SOLUTION

palanikumar
Giga Sage
Giga Sage

Hi,

Check whether you notification has proper sender emails configured.

 

Thank you,
Palani

View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@Alex Sastre 

you are not setting the recipient

Ensure Event parm1 contains recipient checkbox is true in email notification

I assume event and notification both are on sn_customerservice_case table

var grCase = new GlideRecord("sn_customerservice_case");
grCase.addQuery("state", "18");
grCase.addQuery("u_on_hold_reason", "1");
grCase.addQuery("sys_updated_on", "<=", gs.daysAgo(4));
grCase.query();
while (grCase.next()) {
//Sent email if las updated
var gdt = new GlideDateTime(grCase.getValue("sys_updated_on"));
var gdt4 = new GlideDateTime(gs.daysAgo(4));

if (gdt.getDate().toString() == gdt4.getDate().toString()) {
gs.eventQueue("sn_customerservice.case.information.request.reminder", grCase, grCase.assigned_to);
}
}

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Vijay Balotia1
Tera Guru

Hi @Alex Sastre,

 

If event are triggering the validate the following.

1. Make sure in your event and notification are on same table.

2. Make sure in your notification when to send is selected as event is fired and correct event is selected there

3. Make sure if recipients are present in your notification, if not then you can send it via parm1 when your event is fired from your script.

4. Make sure if recipients have valid email address.

 

Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Thanks
Vijay Balotia

 

palanikumar
Giga Sage
Giga Sage

Hi,

Check whether you notification has proper sender emails configured.

 

Thank you,
Palani

Thank you very much, it turned out that the fields I had set were empty in the case itself -.-