Can I use gs.info in a Client Script?

kishorchika
Tera Contributor

Can I use gs.info in a Client Script?

9 REPLIES 9

gs.log() is also a server-side API.

Thanks for your repaly

 

pranita-24
Tera Guru

Hi ,
You can't use 

gs.info in a Client Script?

use console.log()



Bhuvan
Giga Patron

@kishorchika 

 

It can be used only in server-side scripting. If you want to log the information in client script, create a script include and call it from client script

 

https://www.servicenow.com/community/sysadmin-forum/i-want-to-log-in-client-script/m-p/2542551

 

If this helped to answer your query, please mark it helpful & accept the solution.

 

Thanks,

Bhuvan

vignesh parthib
Tera Guru

Hi @kishorchika 


No, you cannot use gs.info() in a Client Script in ServiceNow.

Client Scripts run in the user's browser, so they do not have access to server-side objects like gs.

If you want to log something in the browser console (for debugging), use standard JavaScript logging methods:

console.log("This is a log message");

or

 

You can also use info Message

g_form.addInfoMessage("This is an informational message.")

Thanks,

Vignesh Parthiban