- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2020 11:40 AM
The below code does not print to the script log statements from the security incident scope. I am having issues with the conditions on the business rule however after removing all conditions and validating that the code itself works upon form update of a record I still do not see these gs.info() logs in the script logs table. I've only ever used gs.log() before having done all development in the global scope so I'm not sure if there's something I'm missing here. Any help would be appreciated.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
gs.info('Current.severity before setting: '+current.severity);
gs.info('Previous.severity before setting:'+previous.severity);
current.severity = previous.severity;
gs.info('Current.severity after setting: '+current.severity);
gs.info('Previous.severity after setting:'+previous.severity);
})(current, previous);
Solved! Go to Solution.
- Labels:
-
Scoped App Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2020 12:00 PM
HI,
They might be printing but then you are trying to see them using script log which may filter you logs. When you open the logs table just make sure the source field is empty.
Thanks,
Ashutosh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2020 06:55 PM
Glad that resolved it...not sure how your source field had a filter on it...when going to it from left-hand nav and even type syslog.list it's filter free.
Anyways, good stuff!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-01-2023 02:43 PM
I know this is an old topic, I came across it while searching for something similar. In case someone else comes across this in the future, I wanted to also add: ServiceNow checks for a logging.verbosity property within your application scope. The logging.verbosity property is not created automatically, you'll need to add it yourself. Debug messages will only display if the logging verbosity level is set to "debug". There's an article available here.
However, I think the article is wrong in terms of specifying log levels above debug. For example, setting logging.verbosity to "info" should also include warnings and errors in the logs - no need to specify multiple levels as suggested in the article. You can see this in ServiceNow created logging.verbosity properties.