how to set fields on customer record in before Load event , on before submit event and on after submit event? i am trying to create a message record and check this code.
if (type == 'create')
{
var custRecord = nlapiGetNewRecord();
if(custRecord.getFieldValue('salesrep') != null)
{
var message = nlapiCreateRecord("message");
message.setFieldValue('entity');
message.setFieldValue('message');
custRecord.getFieldValue('salesrep');
var today = new Date();
var tomorrow = nlapiAddDays(today, 1);
message.setFieldValue('startdate', nlapiDateToString(tomorrow));
message.setFieldValue('message',custRecord.getFieldValue('message'));
try
{
var callId = nlapiSubmitRecord(message, true);
nlapiLogExecution('DEBUG', 'message record created successfully', 'ID = ' + messageId);
}
catch (e)
{
nlapiLogExecution('ERROR', e.getcode(), e.getDetails());
}
}
}
why don't i get the message field in my customer record?
I don't realy understand what you want to do :). you set fields with empty values.... anyway to create a messege in NS1.0. you need this :