gs.getErrorMessage() and gs.getInfoMessage()

Prasanthi1
Giga Contributor

we have methods gs.getErrorMessage() and gs.getInfoMessage().

 

Where we use these methods and how to use these methods. what it gives the output. Pls explain...

1 ACCEPTED SOLUTION

Tejas Tamboli
Giga Guru

Hello Prasanthi,

 

The scoped GlideSystem (referred to by the variable name 'gs' in any server-side JavaScript) API provides a number of convenient methods to get information about the system, the current logged-in user, etc.

So, you can use it in Server Script like Business Rules, Script Include, etc.

1) gs.getErrorMessage() is used to Returns the list of error messages for the session that were added by addErrorMessage(). 

2) gs.getInfoMessage() is used to Retrieves the list of info messages for the session that were added by addInfoMessage().

 

For more details you can refer below link: gs.getErrorMessage and gs.getInfoMessage()

 

I hope this will help you.


Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.

Thanks & Regards
Tejas Tamboli

View solution in original post

3 REPLIES 3

Sam Dey1
Kilo Guru

Hi Prasanthi,

'gs' is GlideSystem API from ServiceNow. It is a Server side API which means that you can use it in Business Rules, Server Script of Widgets etc. 

The above mentioned method - gs.getErrorMessage() is used to display list of error message  for the session that were rendered by gs.addErrorMessage().

You can see more details here - GlideSystem

 

Cheers,

Sam

Mark this response as correct if that really helps 

Tejas Tamboli
Giga Guru

Hello Prasanthi,

 

The scoped GlideSystem (referred to by the variable name 'gs' in any server-side JavaScript) API provides a number of convenient methods to get information about the system, the current logged-in user, etc.

So, you can use it in Server Script like Business Rules, Script Include, etc.

1) gs.getErrorMessage() is used to Returns the list of error messages for the session that were added by addErrorMessage(). 

2) gs.getInfoMessage() is used to Retrieves the list of info messages for the session that were added by addInfoMessage().

 

For more details you can refer below link: gs.getErrorMessage and gs.getInfoMessage()

 

I hope this will help you.


Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.

Thanks & Regards
Tejas Tamboli

Mahesh Kumar3
Giga Guru
Giga Guru

find_real_file.png

 

find_real_file.png