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 log, so you must ensure you have it open if using this testing method.

As the JavaScript log will not be open for regular users, it is possible to leave these logs in for future maintenance of scripts. If you choose to do this, make sure that the logs you leave in are well documented and minimal. It is difficult for a new developer to maintain an instance they are new to, where the JavaScript log is constantly being updated. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.135.224