- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2021 01:51 AM
Hi Experts,
I have the questions about gs.info()?
- what is gs.info()?
- When to use gs.info()?
- when not to use gs.info()?
- Why we should use gs.info()?
- Best practice of coding gs.info()?
That is all question of me. Please explain it to help me.
Best regards,
Solved! Go to Solution.
- 31,461 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2021 02:04 AM
Hi,
points below
- what is gs.info()? -it is used for logging messages to system logs
- When to use gs.info()? - it is widely used to debug the server side script in ServiceNow and mostly added to check script ran till which point
- when not to use gs.info()? - it should not be used in production instance; adding gs.info() for debugging is fine but remember to remove that before moving to production as it might lead to unnecessary system logs in production instance
- Why we should use gs.info()? - same as point 2
- Best practice of coding gs.info()? - refer below link
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2023 09:12 AM
Could you please let me know if I use gs.info('info 1'); in script include then will I be able to see this in console that we get in browser dev tools?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2021 02:47 AM
Most ServiceNow API is documented in the Server Global Reference API.
You can do your own self-paced exercises to learn about API here.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2021 02:55 AM
Hi Paul,
Looks like you were wrong.
GlideSystem doesn't specify how to use gs.info() and doesn't explain it either.
I very much appreciate you giving me the answer.
Thanks,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2021 05:48 PM
Nowhere in my response did I say that gs.info was in that API list.
I was merely giving you the tools to find it yourself, which you still weren't able to do.
It is in the Server Scoped API.
Most products have API documentation that is only a google search away.
The concept of debugging is explained in the first link doing a google search.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2023 07:48 PM
Dear Jacky Nguyen,
@Jacky Nguyen , hope you're doing great!
1. What is gs.info?
gs.info is a function in ServiceNow that is used to log informational messages to the system logs. It is similar to the console.log function in JavaScript.
2. When to use gs.info?
gs.info can be used to log messages at any point in a script. However, it is typically used to log messages that are helpful for debugging or troubleshooting. For example, you could use gs.info to log the values of variables, the results of calculations, or the status of a process.
3. When not to use gs.info?
gs.info should not be used to log messages that are not helpful for debugging or troubleshooting. For example, you should not use gs.info to log messages that are simply informative or that do not provide any value for debugging or troubleshooting.
4. Why we should use gs.info?
gs.info is a valuable tool for debugging and troubleshooting ServiceNow scripts. By logging messages to the system logs, you can track the progress of your script and identify any errors or problems.
5. Best practice of coding gs.info?
When coding gs.info, it is important to be specific and concise. Your messages should be clear and easy to understand. You should also avoid logging excessive amounts of information, as this can make the system logs difficult to read and troubleshoot.
Kindly, please mark my solution as Helpful/Correct, if applicable.
Thanks & Regards,
Revanth. K
Product Test Automation Engineer