In advanced conditions scripting, it is easy to overlook complex scripts that return FALSE because the last command evaluates to FALSE, so the email notification is not triggered.

For example, this advanced condition evaluates to FALSE because the last statement evaluates to FALSE:

answer = true;
gs.log("ServiceNow test");

On the other hand, this condition returns TRUE because the last statement evaluates to TRUE:

gs.log("ServiceNow test");
answer = true;

Steps to Reproduce


Create a notification with the following advanced condition:
answer = true;
gs.log("ServiceNow test");

Note that the email notification never triggers even though the log 'ServiceNow test' is logged in the [syslog] table.


After carefully considering the severity and frequency of the issue, and the cost and risk of attempting a fix, it has been decided to not address this issue in any current or near future releases. We do not make these decisions lightly, and we apologize for any inconvenience.

As a workaround, because advanced condition scripts return the last operation's result, ensure that the script's last statement evaluates to TRUE.E.g.: for the use case in the steps to reproduce, you would change the script to:

gs.log("ServiceNow test");
answer = true;

Note that nothing is special about the variable named 'answer' in this context. The last statement must evaluate to true to pass the conditions.


See also related PRB704806/KB0623377 - Email Notifications with only comments in the advanced condition do not trigger because the condition is evaluate to false

Related Problem: PRB925562

Seen In


Associated Community Threads

There is no data to report.

Article Information

Last Updated:2020-06-20 00:33:18