Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Info Message on UI Page?

Daniel188
Giga Contributor

Hoping this is a relatively simple question; I couldn't find it via a precursory search in communities.

On a UI Page, how do I display an info message? 

Use case:

User hits Submit button on UI page
Client Script calls GlideAJAX script include
GlideAJAX does some processing, returns a value
callback function looks like this:

ga.getXML(myCallBack);
function myCallBack(response) {
  var response = response.responseXML.documentElement.getAttribute("answer");
  if (response.blahblah)
	gs.addInfoMessage("Record " + response.blahblah + " inserted successfully."); // doesn't work (gs is undefined)
}
6 REPLIES 6

Tyler Teter
Tera Contributor

The obvious one is alert, but there are a couple other ones that seem to work OOTB in UI pages.

 

this.addErrorMessage()

Unfortunately there isn't a "this.addInfoMessage()"

 

However, I found another workaround. Just define the glideform library yourself, and you can call it from there!

var g = new GlideForm();
g.addInfoMessage()

 

This should be the accepted answer