business rules and gs.addInfoMessage() / gs.addErrorMessage()

rwmarejka
Kilo Contributor

The GlideSystem page (http://wiki.servicenow.com/index.php?title=GlideSystem) describes the addInfoMessage and addErrorMessage methods.

The page on Business Rule debugging (http://wiki.servicenow.com/index.php?title=Debugging_Business_Rules), section 1.2 states that "...you can use gs.AddInfoMessage to display information at the top of the screen"

If I define a global Business Rule that uses these methods outside of function then the message is:

- not displayed at the top of the screen
- under some circumstances the message is displayed in some sections (read: divs) on the page. Note: the same message may appear multiple times on the page.
- most of the time the message is not displayed at all.

Is this a bug in implementation or usage?

1 REPLY 1

CapaJC
ServiceNow Employee
ServiceNow Employee

Not a bug in implementation. Global business rules were never intended to have script outside of a function, so any undesirable behavior is unintended, but at the same time not a bug.

There's a warning when you update a global business rule that has script outside of a function. In my opinion it should be strictly prohibited, but it's currently not.

Global business rules were only intended to hold global functions, long before we could do the same thing with Script Includes.