Can someone point me to a guide on debugging with ...
# suitescript
a
Can someone point me to a guide on debugging with suitescript? I've been uploading it to the sandbox and using log.debug (don't laugh at me).
s
Search for
SuiteScript Debugger
in the help pages
( I never use the debugger, I almost exclusively use
N/log
or
console.log
)
g
I have a coworker that never does, but I find it incredibly valuable. Customization -> Scripting -> Script Debugger.
You can call a record.load and then inspect things on the fly, without having to modify your code and re-upload. I do have my IDE set up so I can alt-shift-U and re-upload any changes, so changes are fast, but I still find it saves a lot of time to step through things and be able to look at exactly what's happening and what's available.
e
Note: @Sandii There are some instances where modules may or may not be available in the console, in which case you’ll need a true server side debugging solution
s
Yes I am aware, you cant use console.log at all serverside
e
i mean there are some calls in the console (in F11 Dev Tools) that you can’t make, so you are forced to go server side for those
g
I guess to ec's point, while log.debug is available, dumping a
log.debug({title: 'stuff', details: record})
still doesn't show the same thing as using the script debugger and looking inside of the record object from the debugger. More insight available IMO.
e
for example, N/task simply isn’t available, so if you need a module that includes a define statement pulling in N/task, you’re stuck if you are in the console
g
Right, but Sandii is saying that using log.debug({...}) is sufficient for getting debugging information, which I agree it can work, I just find it more powerful to use the debugger.
e
i agree with both of you! 😉
i usually stick with script debugging (log.debug) or console.log - which if you log the object itself gives you the same view into the object as in the debugger, in Chrome’s console
now, supposedly there is a debugger tool within the ide itself as well, but I’ve never used it (10+ years in): https://netsuite.custhelp.com/app/answers/detail/a_id/33810/kw/debug%20ide#!
g
I think when discussing the Script Debugger, it's implicitly assuming server side scripts, which Chrome doesn't have access to. log.debug does not give the same information that the debugger gives.
e
Chrome does if you reference them, but it will fail if any of those dependencies have dependencies such as N/task etc
for example, we often use custom modules, and if they are written in a way that they can be used by a client script, you can also reference them via Chrome debugger console
in your require statement