I submitted a case to support on this, and they created a defect #150275. However, I'm in need of a workaround while this is getting fixed, so I was hoping someone else had solved this problem. Here's the issue:
Workflow
1. The contact for the customer creates a case in NetSuite via online case capture. The case is processed normally by NetSuite, and an employee is assigned to the case.
2. The assignee (or customer) receives an e-mail on case creation and when he replies back a SuiteScript unexpected error is generated.
Trigger
If the total length of the reply is large (in other words, the case comments are long and are included in the email reply) then the error is generated. If the reply is short (the user deletes the case comments from the email before sending their message) then the error is not generated. This makes it appear a bit random
The error occurs when the suitescript attempts to use mrecord.getFieldValue('message') to retrieve the body of the message.
A sample user event script deployed to case forms that returns the error is:
function emailupdatecasefields(type)
{
nlapiLogExecution('DEBUG','Successful Entry to emailupdatecasefields, type=',type);
if (type == 'create' || type == 'edit')
{
var ID = nlapiGetRecordId();
if (ID != null) //apparently happens during message previews... weird
{
var mrecord = nlapiLoadRecord('message',ID);
nlapiLogExecution('DEBUG','activity=',mrecord.getFieldValue('activity'));
nlapiLogExecution('DEBUG','author=',mrecord.getFieldValue('author'));
nlapiLogExecution('DEBUG','entity=',mrecord.getFieldValue('entity'));
nlapiLogExecution('DEBUG','incoming=',mrecord.getFieldValue('incoming'));
nlapiLogExecution('DEBUG','type=',mrecord.getFieldValue('type'));
nlapiLogExecution('DEBUG','message=',mrecord.getFieldValue('message')); // **** error occurs here ****
}
}
}