Unable to print object value of Script Include in System Logs? How to print object value in Sys Log?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2024 07:08 AM
Unable to print object value of Script Include in System Logs? How to print object value in Sys Log?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2024 07:11 AM - edited ‎02-13-2024 07:11 AM
use JSON.stringify(obj); to print object value in System log.
Example
// obj is a JSON formatted object
var str = JSON.stringify(obj);
// str is a string containing content to be turned into a JSON formatted object
gs.info(str);
Source: https://developer.servicenow.com/dev.do#!/reference/api/tokyo/server_legacy/c_JSONAPI
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2024 07:13 AM
Hi @VIKAS45
You can use gs.log('Unique name to identify the value in logs '+variable);
Also if the var is array type then var.toString() or JSON then use JSON.stringify(var);
Please mark this as helpful if this resolves your query.
Thanks!