Hi,
I have a scheduled script that runs through my last months bills and updates a custom column field on the line items.
This script has been running fine for the past few months but it's stopped working this month. When I run it I get an error message that reads:
Error: USER_ERROR
The total can not be negative.
Stack Trace: clearLocProcessedonBills(ServerSideScripts2.js:195)
My conclusion here is that I have a rogue bill that won't submit when I call nlapiSubmitRecord.
I have therefore added in a debug log so that I can figure out which transaction is causing the problem:
var tranID = record.getFieldValue('internalid');
nlapiLogExecution("DEBUG", "Submit Error", "user event: " + type + " for " + " id: " + tranId);
nlapiSubmitRecord(record);
My understanding is that if the nlapiSubmitRecord fails then the debugger logs the information I need.
However, when I run the script the debugger reads:
user event: userinterface for id: null
I've tried changing the first line to read
var tranID = nlapiGetFieldValue('internalid');
but that doesn't work either.
It's very frustrating. All I'm trying to do is find out which transaction is causing the fail but it's taken me two hours to do it!!!
Can anyone help me figure out which transaction is causing me problems?
Thanks,