ServiceNow Scripting alert, info, and error messages

You can send messages to customers as alerts, informative messages, or error messages.

Business rule and other general use scripts


Script Result
current.field_name.setError(“Hello World”); Will put “Hello World” below the specified field.
gs.addInfoMessage(“Hello World”); Will put “Hello World” on the top of the screen.
gs.print(“Hello World”); Will write to the text log on the file system but not to the sys_log table in the database.
gs.log(“Hello World”); Will write to the database and the log file.


Client side scripts


Script Result
alert(“Hello World”); Will pop up a window with “Hello World” and an ‘OK’ button.
confirm(“Hello World”); Will pop up a window with “Hello World?” and a ‘Ok’ and ‘Cancel’ buttons.
g_form.showFieldMsg(“field_name”, “Hello World”, “error”); Puts “Hello World” in an error message below the specified field.
g_form.hideFieldMsg(“field_name”); Hides an error message that is visible under the specified field.


0 0 vote
Article Rating
Inline Feedbacks
View all comments