Discussions
SuiteWorld brings thousands of innovators, builders, and leaders together to learn, connect, and shape what’s next. This October, explore how to build a stronger foundation for growth through inspiring keynotes, major product reveals, hands-on sessions, and unforgettable moments—all in one place for our biggest event of the year. Join us
help me with the following code
function myBeforeLoad( type, form )
{
nlapiLogExecution( 'DEBUG', 'test userevent:beforeload', 'entry of this function' );
if( type == 'create')
{
nlapiLogExecution( 'DEBUG', 'create', 'in create subbranch' );
}
else if( type == 'view' )
{
nlapiLogExecution( 'DEBUG', 'view', 'in view subbranch' );
var oldrecord = nlapiGetOldRecord();
var newrecord = nlapiGetNewRecord();
// nlapiLogExecution( 'DEBUG', 'oldrecord content', oldrecord.getRecordType() + " and " + oldrecord.getId() );
// nlapiLogExecution( 'DEBUG', 'newrecord content', newrecord.getRecordType() + " and " + newrecord.getId() );
if( oldrecord == newrecord )
nlapiLogExecution( 'DEBUG', 'comparison', 'new equals to old' );
var type = nlapiGetRecordType();
var id = nlapiGetRecordId();
nlapiLogExecution( 'DEBUG', 'direct get content', type + " and " + id );
}
else if( type == 'edit' )
{
nlapiLogExecution( 'DEBUG', 'edit', 'in edit subbranch' );
}
}
as the highlighted part, newrecord is the one returned by the server, however, oldrecord is null. how did it come about? as for the blue part, the method getRecordType() could not be executed. why?