Not quite following; can you share some code and h...
# suitescript
e
Not quite following; can you share some code and help me better understand what you're trying to accomplish?
t
Sure! So lets say I have a SS2.0 script, and I want to run it in the Eclipse Debugger. In SS1, I would have something like this: afterSubmit(type) { // do something in function
afterSubmit(type) { // do something in function } afterSubmit()
That way, the script would have an entry point into the script. I'm not sure how to recreate this behavior for a 2.0 script though
e
ah
t
///** * @NApiVersion 2.x * @NScriptType UserEventScript * @NModuleScope SameAccount * @NAmdConfig /SuiteScripts/SuiteScripts 2.0/Esker/configuration.json */ define(['N/error', 'N/record', 'N/search', 'validation', 'esker', 'ramda', 'lodash', 'keymap'], /** * @param {error} error * @param {record} record * @param {search} search */ function (error, record, search, validation, esker, R, _, KeyMap) { /** * Function definition to be triggered before record is loaded. * * @param {Object} scriptContext * @param {Record} scriptContext.newRecord - New record * @param {Record} scriptContext.oldRecord - Old record * @param {string} scriptContext.type - Trigger type * @Since 2015.2 */ function afterSubmit(scriptContext) { //do something } return { afterSubmit: afterSubmit } }
e
Yeah so for the SS2.0 in Debugger, you need to do
require()
instead of
define()
so you basically
Copy code
require([...], function (...) {
  function afterSubmit() {
  }
  afterSubmit();
}
I think
t
Hmm let me give this a shot, I'll report back in a minute
e
🙂 I don't use the debugger, so hopefully someone else who does can help, but I do know you need to use
require()
instead of
define()
t
Hmm no luck with replacing the define tag. When I try that way, it shows a message of "SuiteScript debugger session started." then after a second it shows "SuiteScript debugger session terminated"
b
@erictgrubaugh example looks fine. A more traditional use of the debugger might be to leave your script file as is and debug an existing script
e
Yeah we've already reached the limits of my debugger knowledge =/ I've always been a print-statement troubleshooter
t
@battk what do you mean by that?
b
You can debug existing scripts in an account if you are the owner and the deployment status is testing
The script debugger in netsuite has a button to select existing scripts
You select the script you want to debug and then do an action that normally triggers the script to begin debugging
t
Ah, I see what you're saying. I've never been a fan of the native NetSuite debugger to be honest
b
I hate it too. However it performs an essential function
t
@battk I am trying to debug existing script in the NetSuite debugger but it is just sitting on "Waiting for User Action" with a spinning wheel. Am I supposed to be doing something, or is it just really slow?
Nevermind, I didn't realize I had to perform the action that fires the script
b
No problem i tried to leave usable instructions