Email notification not being sent when "Send When" condition is set to "Record inserted or updated"

sschleicher
Kilo Explorer

When setting up a new email notification, it would seem that I can configure an email based on two base conditions based on the options listed in the "Send When" drop down:

1) When an Event is fired
2) When a Record is inserted or updated.

While I know I could try the Event route, I would like to get the second option working based on a record that is already being logged into the syslog table.

Here are the steps I have taken.

1) Created an email notification that should send when a record is inserted into the Log Entry (syslog) table with a keyword in the message.

2) Validated that a business rule is creating a log entry with the keyword specified in the email notification condition by viewing the script log.

3) Validated that the email is not being sent by viewing the email log.

Shouldn't this be all that is needed to configure this type of email notification? I have not selected an email template (do I need one). The email populates the subject and simply contains the message value of the record inserted into the script log. Email notification is active.

1 ACCEPTED SOLUTION

CapaJC
ServiceNow Employee
ServiceNow Employee

Okay, I did a quick test, and I think the issue is that gs.log("message") doesn't run GlideRecord's workflow or scripts/engines. This is probably a very good thing - imagine if someone wrote a business rule on syslog that wrote something to the syslog table? (shudder)

So Notifications don't get a chance to react to inserts/updates to the syslog table.


View solution in original post

9 REPLIES 9

Aaron40
Kilo Guru

Have you tried testing your email notification by manually created a new record yourself that meets your conditions? I have a feeling maybe it's the fact that a business rule is creating the record that is preventing your notification from being created. I could be wrong but I thought I heard somewhere that business rules have the ability to do things without triggering other events/activities.


I could definitely try that, but the only way I know of to manually create an entry in the syslog is to script a gs.log() from a business rule. Do you know of a quick way to test it? It is worth noting that the log entry which should have triggered the email notification from the business rule indicates it was created by me (not system).


CapaJC
ServiceNow Employee
ServiceNow Employee

Is your condition that "Message [contains] [some text]"?

Or are you actually using the "Keywords" option in the field chooser? Keywords depends on the record being text indexed, which will definitely not have happened by the time the Notification's condition is evaluated. And I don't think the System Log gets text indexed anyway (which is another reason that would fail - text indexing the System Log would be a Bad Thing, since it's such a high-activity table).

So if you're using Keywords, try using the Message field instead.

Either way, I think I have a mild concern about this Notification affecting performance if your System Log table gets a lot of activity. Then again, a lot of things that write to syslog might do it with GlideRecord workflow turned off so Business Rules and Notifications wouldn't run.


Yes it is "Message [contains] [some text]". Sorry to use the confusing "keyword" thing (I forgot that is also listed in the drop down box). I agree with your performance assessment by the way. I have an existing business rule that is already logging to the sys log when an HTTP error occurs. If I change the business rule, I have to go through a change control process. Using email notification without events allows it to work "as is" and gives me a temporary solution to know when the condition occurs.

Overall though, if Service-now allow email to be triggered in this way, I kinda want to see it work to understand the pros and cons of each. Seems like a simply thing to configure yet there must be something I don't understand.