Tag Archive for 'error'

New Implementation of nlapiStringToDate in 2009.2

All of a sudden, our users complained that one of our NetSuite process failed. They reported this error:

TypeError: Cannot call method “getTime” of null (some_code.js$sys#791)

I tried to debug the code using nlapiLogExecution can still couldn’t locate where the error occured. I up the ante by using the script debugger and found that the error happens because the code is trying to call the getTime of a null object. Pretty self explanatory, but why did it happen? The code roughly looks like this:

var billDateStr = rec.getFieldValue("custrecord_billdate")
var billDate = nlapiStringToDate(billDateStr);
var billTime = billDate.getTime();

Continue reading ‘New Implementation of nlapiStringToDate in 2009.2′