Judiciously Placed Print Statements
Created: May 30, 2017
"The most effective debugging tool is still careful thought, coupled with judiciously placed print statements."
-- Brian W. Kernighan
No matter how smart, savvy, or experienced you are with SuiteScript (or any programming language), you are going to make mistakes and introduce bugs - repeatedly. This morning alone I made several while trying to detect duplicate Case records being created.
Using the system I outlined in this week's logging topic, I was able to quickly narrow down the sources of these issues and rectify them. After more than a decade of programming, log messages are still my #1 debugging tool.
However, I know that's not true for everyone, and there are a couple of tools you can use to aid in your own SuiteScript debugging efforts:
- Your browser's developer console is a great place to try out ad-hoc snippets of code. I highly recommend learning how to use your favorite browser's developer tools:
- The Eclipse-based SuiteCloud IDE comes with a debugger that will actually execute NetSuite code for you; see the entire "SuiteScript Debugger" section in Help