SUPPRESSING ONDISPLAY BUSINESS RULES IN POPUPS
Quite often we use onDisplay Business Rules to alert users from server side with some important information. This works pretty well but those info messages may be displayed multiple times.
The reason behind is that onDisplay Business Rules fire not only when you load a record form but also in popups when you just hover over (i) icon that is displayed to the left on every record in a list or on a reference field on the form. As a result the info messages that you add using gs.addInfoMessage() / gs.addErrorMessage() are saved in your session and displayed on the NEXT page which may lead to misunderstanding or duplicate info messages displayed on the form.
It works pretty well on the form:
However, if you, being in a list, hover over (i) icon near the record a couple of times and then navigate to a record or (which is even worse) hover over (i) icon in a populated reference field to display the details and then navigate to a new page (e.g. save incident where you hovered over Caller set to « System Administrator ») then the info messages will be displayed which proves that onDisplay Business Rule fires several times exactly when you just hovered over the record. No info messages immediately but on the next page. Argh what a pity!
How to fix that:
Simply add a Condition to your onDisplay Business rule:
Now your onDisplay Business Rule will NOT run in popups.
This text was originally published on LinkedIn.