

If you leverage the other options available, you can typically avoid having to dive into the detailed node logs.

I might do a future entry just on node logs as there is lots to cover but isn’t a general use case. ServiceNow logs quite a bit of detail inside of the node logs. The node logs are the point of last resort for most debugging. One note: if operating in the global scope, use the source parameter to help facilitate filtering. I discourage system log entries for normal operations as they pollute your codebase and log table with noise. Inserting logs can be quite useful especially for warn and error statements once a given script is in use in production.

No entry on debugging would be complete without at least a reference to the old stand-by, logging. Figuring out how and why your result didn’t reach the outcome you inspected can be quickly determined with this method.Ī Tip is invoking an asynchronous process directly through background scripts or the rest API explorer. Using the inspector, you can see the value for all of the variables as you step through your script and other scripts called later in the execution flow. Leveraging the script breakpoints can be a powerful tool to reduce the need for log entries to validate field and object values. You can read more about the details of the script debugger in the detailed blog entry. Thus you can safely debug without impacting your fellow developers. Only the developer that set the breakpoint, and only in their session in which a script debugger window is opened, will be paused. That pausing leads to an essential note: breakpoints only apply in direct synchronous sessions. Breakpointsīreakpoints and Conditional Breakpoints are where we insert a pause in the execution flow. That way, you have some idea of what things look like before you changed anything.
Node script debugger update#
Give it a try on an update of a record you are familiar with before adjusting any business logic. One way to do that is to try out the debugging before you encounter an issue.
Node script debugger how to#
Knowing how to best filter, find, and examine the results will enable you to develop faster and hopefully with fewer errors. Utilize the clear log tool between tries to help lessen the noise when applicable. The joining of all the logs into one powerful interface should help you find the root cause of whatever you are inspecting. Access can be easily checked by using the security debugging along with impersonation.

(we will talk more about breakpoints later). If you wish to know why your new script isn’t adjusting a field as you expect, then the business rule would be my first visit unless you can utilize a breakpoint. What kind of information you are seeking will lead you to one or several of the debugging options. When should you use the session debugging? session debugging has a variety of options from ACL to Business Rules to Upgrade. Most debugging will not need all debugging types turned on, as that will produce to much noise that must be filtered to find the information you as the developer are looking to find. Only log entries for the debugging types that are enabled will be visible and then filterable. The filter narrows the displayed log, where the settings toggle debugging options on/off. It can be confusing to see a filter for debugging options like business rules and also a setting for business rules. The filters in the dropdowns can be handy when many things are happening at once. The search filter does what you would expect, filter the log entries to just lines that contain the search term. Selecting one of the transactions will jump you to the start of that transaction in the log entries. On the left, you have the transaction list available. The session log and debugging options are available in this interface. Now when selecting a session debugging option from the navigation, a new window launches. A session is a unique login for a unique user - typically one browser on one device. Session DebugĪ feature released in the New York release unified the session debugging modules. Today we will look specifically at several ways to debug when doing scripting. An array of tools are available to help developers understand what the system is doing and narrow down where unexpected behavior is happening. Debugging in ServiceNow is am essential skill to master.
