Discussions
Join us for complimentary one-day events around the world and step into a future fueled by AI and limitless potential. Explore new breakthroughs, sharpen your skills, and connect with experts who are shaping what’s next. Experience bold keynotes, interactive learning, and connections that span the global NetSuite community. Discover what's next at SuiteConnect Tour 2026.
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?