I have a RESTlet that triggers a transition on a v...
# suitescript
w
I have a RESTlet that triggers a transition on a vendor bill approval workflow. When it runs workflow.trigger(), an unhandled error is thrown on that line in the RESTlet script. "RCRD_DSNT_EXIST". When the trigger is executed, there's both the actions executed in the new state (which seems to execute of) and there's also the actions in a succeeding state that it enters as well. All of which triggers several UE-scripts. This error is not directly caused by the workflow.trigger, but instead it is most probably caused by some aftersubmit script/workflow. I suspect aftersubmit because all fields are updated as expected. Does anyone have any general tips on finding the culprit? • The error only occurs occasionally and I can't disable the scripts in production as they are needed. • Some of the scripts are bundles, so I can't add additional logging on them to see if they are able to run its course • There are no script-logs around that time that indicates that any other script has failed
b
try changing the audience of the script deployments in a way that wont trigger them for your script
although its usually easier to go through the script logs, thrown errors are logged at the system level
w
I've gone through the system logs and no errors other then on the RESTlet is thrown.
(no other system-errors)
I'm reluctant to disable the scripts for the execution-context/role as the scripts should execute. Perhaps I can put two dummy UE-script around a suspecting(bundled) one to see if it can log both before and after it?
If one script fails on after submit, all subsequent after submit scripts wouldn't execute, right?
b
you can try, but nothing you have mentioned so far sounds like a user event script problem
w
Workflow?
b
i personally would lean towards your own script being the problem
especially if the workflow works in normal operation
w
I can see in the workflow logs that the workflow.trigger() is executed as it moves to the correct state.
t
If one script fails on after submit, all subsequent after submit scripts wouldn't execute ?
Is it so ? I am not aware of this
🤔 1
w
Is it not? I would expect it to throw a usererror and stop the execution.
I can also see that the error is thrown several seconds after the initial transition has occurred. Look at the timecodes, the transitions occurs 120711 but the error is thrown in the RESTlet on 120714. The same second the AfterSubmit-trigger is executed in the workflow (no actions there)
b
you probably want to just make a user event script that throws an error
so that you can see what thrown errors look like
anything less than system wont be a problem for your restlet
all those debug and error logs are things being handled normally
w
I understand that. I was just showing ALL script logs during the relevant timeperiod.
Just to show that there isn't any other System-errors. But I'll create a faulty AS-UE-script to see how that would manifest.
Alright, so I tested with a dummy script that tried to load a record that didn't exist. The error that was passed to the RESTlet was the same and only referenced the line in the restlet script. But the UE-script got its own log of the type System for the error. And that is not something I get in my real error. So that would rule out any UE-script... This is a PITA
d
have you tried using a test scheduled script, to make changes to the vendor bill and see what happens?
also look into NetSuite Scripted Records extension for Chrome, that will give you a list of what is running on the record
b
again, i personally would say no system logs means no scripts are causing your problem
so that either means its the workflow
which would probably only happen if a script deleted a record the workflow uses
or that its your own script
hopefully your stack trace tells you that information
w
{"type":"error.SuiteScriptError","name":"RCRD_DSNT_EXIST","message":"That record does not exist.","stack":["Error\n    at Object.doPut (/SuiteScripts/Vendor Transaction Approval/rl_vtrintegrationforapp.js:2360:37)"],"cause":{"type":"internal error","code":"RCRD_DSNT_EXIST","details":"That record does not exist.","userEvent":null,"stackTrace":["Error\n    at Object.doPut (/SuiteScripts/Vendor Transaction Approval/rl_vtrintegrationforapp.js:2360:37)"],"notifyOff":false},"id":"0","notifyOff":false,"userFacing":true}
the stacktrace only points to the line that does the workflow.trigger(). I've looked at all workflows on that record and I can't see any errors in those logs.
I'm opening a case with Netsuite to see if they can see anything else in the backend.
b
the internal error suggests that its the workflow thing i mentioned
w
You mean that a something has deleted a record that the workflow uses, hmm, will look into that.
I'd expect that the workflow would store a log of that though.
I've searched in the deleted records table. There are no records deleted during that time period.
For anyone interested... the issue was a combination of a workflow that had a subscribe to record action and that the workflow had a couple of instances that were not connected to a record. Cancelling the instances solved the immediate issue but it returned with new disconnected instances. I ended up reworking the workflow. The subscribe to record action was not necessary.