

Just change your ' Configuration item' field value and you will see that execution of code will STOP at the line of code where you have set your debug point. Once debug point is set, you are all set to start your debugging. Successfully setting of debug point is indicated by highligting the line number in blue color. In my example that is at line number 2662 wo I will click on that number and this will set the debug point. For setting the debug point just do a single left click on the line number where you see your code. To do this I will have to set the debug point at that line. I will start the debugging at first line of code. Now since it's just two lines of code, issue could be at first line of code or second. Now click on the central pane where client side codes are showing and press CTRL + F and search for your any one line of your code from your script: Click on the ' Source' table and then click on file whose name starts with ' incident.do?sys_id='. Open any incident form and open the developer tool on that page. Below is the script that I have written with small issue because of which short description is not populating as per my expectation. The format of the short description will be "Issue with configuration_item_value". In this script we will set the value of short_description field based on Configuration item selected. I am writing a client script on Incident table. Let's take a hypothetical example for debugging. Click on this file and it will show all the client side codes that are written for this table in the centre pane of the developer tool. Below is an example of a record that belongs to change reuest table : In this list you will see one file with name tableName.do?sys_id=sysid_of_the_record , you need to click on this file.

Which contains all the files that are used to display this form and those which will control the form on your browser. On this tab you will see there is a page section in the left side of the pane. Open any servicenow record's form and open developer tool.

For this article what is relevant is ' Source'. Now if you see, there are multiple sections in this tool. Right click on the page and select last option Inspectīelow is the screen shot of how developer tool looks like, you will notice this open at the bottom of your page or right hand side of the page In google chrome you can access developer tool by below ways :Ģ. Here I am using Google Chrome to show case. There are different ways how you can access that and is also dependent on the browser you are using.

All of the browsers that we use are equipped with developer tool, those who use console.log() must already be aware of this. Now let's see how we can use this POWER to debug client side code. But at Client side you have the POWER !!!! Here also by control I mean control on the execution of code written at client side.Īnd that's the reason why, how well you can debug server side code lies at the mercy of options made available by server. By control I mean when the execution of code starts you can't hold it in between.īut this is not the case with client code, as client side code executes locally on your browser and the code that executes on your system you can control it. Server side code executes at the server and since that's not on your machine, you do not have control over it's execution. Lets go to the basics of execution platform of client and server code. So, is there a way I can debug my client side code silently without using alert(s) and without bothering anyone else ? Ofcourse, YES!!!!īefore we go on to the soultion. This approach is no doubt helpful but, what if you are not sure at which line of code you are having data processing issue? You may end up with multiple alert messages and unknowingly you may end up irritating other people who are working on the form, as those alerts will popup on their screen as well The most approached way I have seen that developers follow is using alert() method or console.log() method.
SERVICENOW SCRIPT DEBUGGER NOT WORKING HOW TO
Now there could be 'N' number of reasons why your code migh not work, but how to know ? Often they have no clue why the hell their code is not working the way it should. I have seen many developers struggling and killing lots of their productive time in finding error/bugs in the code.
