logo

NJP

https://web.archive.org/web/20181121122742/https://servicenowgems.com/2016/09/

servicenowgems.com · Sep 09, 2024 · article

Adding a form message to the top of the form is easy enough by using the g_form.addErrorMessage or g_form.addInfoMessage functions. Then getting rid of them is again, another simple call of g_form.clearMessages() which does what the name implies and removes them all.

My scenario where this didn’t work so well was where I was adding a form error message on a particular action and if they kept doing that mistake, it kept adding a form error message. The obvious thing to do therefore was to use clearMessages() before each addErrorMessage but it was removing form messages which I didn’t want to be removed.

Turns out ServiceNow have a hidden argument to addErrorMessage/addInfoMessage to set a html ID to the field.

Continue reading

View original source

https://web.archive.org/web/20181121122742/https://servicenowgems.com/2016/09/