Broken Email Notification - Yet Preview Works

G24
Kilo Sage

Hello, smart folks.  What am I doing wrong here, please? ...

 

I created a notification which looks like this:

222.png

 

The associated Email script looks like this:

333.png

 

When I use the "Preview Notification" button, and supply the record number of an HR Benefits Case, everything seems to work fine, as you can see here:

000.png

 

But when the email is actually sent out, I don't get any data from the "comments_and_work_notes" field or the mail script, as you can see here:

111.png

 

How can the Preview work, but the actual email functionality Not work?

1 ACCEPTED SOLUTION

G24
Kilo Sage

Found the answer with help from ServiceNow tech support...

There is a ServiceNow bug around the comments_and_work_notes field.  It is documented in an existing knowledge article available here:

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1587782 

View solution in original post

9 REPLIES 9

Hi @G24 

 

It seems that the script is executing correctly during the preview but not when the notification is triggered by a new work note.

The reason for this might be that the script is running before the new work note is fully committed to the database.

To solve this, we can add a slight delay before fetching the "comments_and_work_notes" to ensure that the new work note is saved. You can use // gs.sleep() // to introduce the delay.

 

Please don't forget to mark this as "Helpful" and press "Thumbs Up."

Thanks, but that does not seem right to me, because there are already work notes present, and the field / script does not display those existing ones either.  It seems like some kind of an ACL or Permissions thing to me, but I can't figure out what is getting blocked.

Sandeep Rajput
Tera Patron
Tera Patron

@G24 How are you triggering this notification, via an event or a record action?(insert/update) It seems that your notification is not getting associated with the HR Case record hence you are seeing the empty values in the notification.

Record Update.

G24
Kilo Sage

Found the answer with help from ServiceNow tech support...

There is a ServiceNow bug around the comments_and_work_notes field.  It is documented in an existing knowledge article available here:

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1587782