Jslog

Another way of testing and debugging client-side scripts is using jslog. When using jslog, you can write lines in scripts to send logs to the JavaScript log. The JavaScript log can be opened in the developer system settings so that messages can be viewed. This method will only show logs to users who have the JavaScript log open, so it can be a less intrusive method of testing scripts.

The contents of a jslog message can be the same as a message using alert. Let's have a look at how we write this in script:

jslog('Testing Message');

In the preceding example, the message Testing Message will appear in the JavaScript log. Jslog can contain strings or variables, but it will not display in the ServiceNow logs. It only appears in the JavaScript ...

Get Mastering ServiceNow Scripting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.