I have a new one. I have a script that does a lot ...
# suitescript
s
I have a new one. I have a script that does a lot of validations before creating the SO. All validations are successful. The screen save but get an error. Something about email. I know it's something in the Scripted Record, unfortunately we have many user event. I'm going 1 by 1 but I think that there should be something better. Is there's a way to track it ?
k
Script Execution Logs. This should let you know which User Event Script is causing the error.
s
I'm getting the error from the Execution log of the script that save the order. However one of the userevent has an error. That's what I'm looking for
k
Do you mean one of the entry points? If you do then do you have the full error? Eg the stack trace?
s
I'm doing this var _soid = rec.save({enableSourcing: true,ignoreMandatoryFields: true}); And it return this Save SO Failed ID=6673303{"type":"error.SuiteScriptError","name":"USER_ERROR","message":"Please specify an email address to send to","stack":["anonymous(N/serverRecordService)","reduce(/SuiteScripts/KK Map Reduced/simon_mr_test.js:502)"],"cause":{"type":"internal error","code":"USER_ERROR","details":"Please specify an email address to send to","userEvent":null,"stackTrace":["anonymous(N/serverRecordService)","reduce(/SuiteScripts/KK Map Reduced/simon_mr_test.js:502)"],"notifyOff":false},"id":"","notifyOff":false,"userFacing":false} Remaining Governance=4929
k
Ok so itโ€™s a MR that is creating the record. And the record is trying to send an email on a user event or a workflow?
I would assume then you have either a script or a workflow running somewhere that is trying to send an email on save but not checking to make sure an email address is there before trying to send it.
s
Exactly. The problem is that we have, not what I wanted, over 50 "events". It's long to go one by one. I'm wondering if Netsuite has a tool to track an error like that
k
No. Surely you must know what workflows/scripts are against that record by using scripted records?
There is no way you have 50 workflows/scripts against one record
s
I just joined that company, That's what they have, 50 or so
k
No way. What record type is it?
s
Sales Order
k
My gawd. Start checking now ๐Ÿ˜‚
Would do workflows first as you would hope it is named easily.
Possibly an approval email? But defo start there
b
usual answer is to hope that the error was thrown in the user event script itself
and just search the script logs to find the matching log and script
thats unlikely to be the case here, the error you are getting is probably from something setting tobeemailed to true, and there not being an email on the sales order
if you are lucky, someone wrote the user event script wrong and did the work in an after submit
the other approaches are to download all the script files and search for scripts messing with email
or play the elimination game and start disabling scripts and workflows until you find the one you are looking for
emphasis on the plural part there, disabling them one by one is basically the slowest strategy there
s
yes I've downloaded all the scripts.. more than 400 regarding emails... ๐Ÿ˜ž I
thanks all for your help